I have found that international alphabet symbols in native.newTextBox go as two symbols. Just like in old sytle SMS that had (to my memory) 80 symbol limt (160 as per Google) if you use Egnlish… and twice less if you use Greek, Cyrillics, etc.
When I work with TB, I want to limit number of symbols… I just cut it by 300. If by any chance I use BOTH English & Russian, a strange sybmol appears at the end: � I is “a half” of a any Russian letter that is at the end of the string. I cannot get rid of it by string.gsub!
Also, does anybody know how to get rid of two new-line sybmols? ("\n\n")
local function Req_textListener_sub( event )
if event.phase == "editing" then
local our_TB = event.target
local our_text = our_TB.text
our_text = string.gsub(our_text, "�", "") -- DOES NOT WORK!
our_text = string.gsub(our_text, "\n\n", "\n") -- DOES NOT WORK!
our_text = string.gsub(our_text, "11", "1") -- Works fine! (added just to check that gsub works)
local a_length_int = string.len(our_text)
if a_length_int > 300 then
our_text = string.sub(our_text, 1, 300)
-- � can appear here if international alphabets used together with English...
our_text = string.gsub(our_text, "�", "") -- DOES NOT WORK again :-(
end
our_TB.text = our_text
end
end