Problems with russian-characters in table

I’m currenly making word-guess game. I have module script in it in which i have table with all words.
Words from this table should be written at the board. It works with english words, but with russian I have a lot of problems.

I’m packing recieved word into table via string.split(“string”, " ") method, and i have 2 problems with this packing:
1. All packed non-english characters are duplicating (if word consists of for example 4 characters, I get table with twice more children - 8)
2. All packed non-english characters are replaced to question symbols (like this: �)

What I Already tried?
I dont know what i can do with that, so I rely on you guys. If you can’t understand smth or need more details or images/videos - let me know.

Problem with special characters, the same goes for emojis:

local Text = "🤓👆"
for _, k in pairs(Text:split("")) do
	print(k)	--> � x8
end

How to solve it? using utf8.graphemes

Same logic as this post.

local Text = "🤓👆"
for a, b in utf8.graphemes(Text) do
	local char = Text:sub(a, b)
	print(char) --> "🤓", "👆"
end
1 Like

Bro thank you so much. I fixed it in 3 minutes after reading your post. Thank you again, you saved me a lot of time!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.