How to get the REAL length of the string with cyrillic symbols in lua?
If i'm using string.len("HELLO.") - I will get 6
But with string.len("ПРИВЕТ") - I will get 12(Same with "#" operator)
So the number of symbols didn't changed, but we got different numbers... It's because cyrillic symbols has two bytes, when english letters, numbers and etc has 1. I want to know how to get the right and real length of string(Get 6 in both samples). Everyone who can help?
len
and#
return the number of bytes in the string, regardless of those bytes being encoded text.str_len = #('ПРЕВЕД!'):gsub('[\128-\191]', '')