utf8


API Reference
Functions
char
utf8.char(codepoints:Tuple<number>):string
Parameters
codepoints:Tuple<number>
Returns
Code Samples
Utf8 Char

codes
utf8.codes(str:string):function,string,number
Parameters
str:string
Code Samples
Utf8 Codes

codepoint
utf8.codepoint(
str:string, i:number, j:number
Parameters
str:string
Default Value: 1
Default Value: i
Returns
Code Samples
Utf8 Codepoint

len
utf8.len(
Parameters
Default Value: 1
Default Value: -1
Returns
Code Samples
Utf8 Len

offset
utf8.offset(
Parameters
Default Value: 1
Returns
Code Samples
Utf8 Offset

graphemes
utf8.graphemes(
str:string, i:number, j:number
Parameters
str:string
Returns
Code Samples
Utf8 Graphemes
-- "e" followed by a combining acute accent is one grapheme but two codepoints
local str = "ae\u{0301}b"
print(utf8.len(str)) --> 4
for first, last in utf8.graphemes(str) do
local grapheme = string.sub(str, first, last)
print(first, last, #grapheme)
end
--> 1 1 1
--> 2 4 3
--> 5 5 1

nfcnormalize
utf8.nfcnormalize(str:string):string
Parameters
str:string
Returns
Code Samples
Utf8 NFC Normalize
local decomposed = "e\u{0301}" -- "e" plus a combining acute accent
local composed = utf8.nfcnormalize(decomposed)
print(utf8.len(decomposed)) --> 2
print(utf8.len(composed)) --> 1
print(composed == "\u{00E9}") --> true

nfdnormalize
utf8.nfdnormalize(str:string):string
Parameters
str:string
Returns
Code Samples
Utf8 NFD Normalize
local composed = "\u{00E9}" -- precomposed "é"
local decomposed = utf8.nfdnormalize(composed)
print(utf8.len(composed)) --> 1
print(utf8.len(decomposed)) --> 2
print(decomposed == "e\u{0301}") --> true

Properties
charpattern
utf8.charpattern:string
Code Samples
Utf8 Charpattern

©2026 Roblox Corporation. Roblox, the Roblox logo and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.