Skip to content

utf8.char

Shared

Generates a string representing the character codepoints as arguments.

Syntax

string utf8.char ( ​int codepoints... )
Required arguments
  • codepoints...: An variable argument sequence of code points representing the desired unicode characters.

Returns

Returns a string representation of the codepoints passed.

  • string: value

Code Examples

shared

This example separates an input string into single codepoints and then joins these back together, representing the original input string.

local input = "Hello World"
local codepoints = {utf8.byte(input, 1, utf8.len(input))}
local joined = utf8.char(unpack(codepoints))
print(joined) -- Hello World