|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Thu Mar 30, 2017 4:26 am Post subject: Unicode / UTF-8 string pattern |
|
|
Hi there, I tried a test a lua function to handle Unicode / UTF-8 character using lua, so it can use to write or display unicode on a label, listbox, form, etc.
Lua file as attached (copy paste to CE table lua script and execute).
Example :
Code: | t1 = {}
s1 = "こんにちは世界=Japan"
for k, v in utf8.gmatch(s1, "([^%p%s%c]+)=([^%p%s%c]+)") do
t1[k] = v
end
for k,v in pairs(t1) do
lb2cap = print(k,v)
end
lb2.Caption = lb2cap
-- lb2.Caption will show as "こんにちは世界 Japan"
|
But i have problem for Russian character :
Code: | s = "Привет, мир, от Russia"
for w in utf8.gmatch(s, "[^%p%d%s%c]+") do
print(w)
end
[[ it show as :
Привет
мир
от
Lua
]]
[[ i want it show as : "Привет, мир, от Russia"]] |
which string pattern can use for that ?
Thanks
Description: |
|
Filesize: |
22.44 KB |
Viewed: |
8354 Time(s) |
|
Description: |
|
Download |
Filename: |
Displaying UTF8.lua |
Filesize: |
23.77 KB |
Downloaded: |
533 Time(s) |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri Mar 31, 2017 3:25 am Post subject: |
|
|
Code: | s = "Привет, мир, от Russia"
for w in s:gmatch("[^%p%d%s%c]+") do
print(w)
end
shows:
Привет
мир
от
Russia |
About displaying:
_________________
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Fri Mar 31, 2017 6:41 am Post subject: |
|
|
Ah..I see, mgr.inz.Player.
So, no need a function to handle UTF-8/Unicode since CE 6.5 / CE 6.6 (lua 5.3), right ? or is it depending by system operation installed on computer ?. Need to know if this correct displaying on other computer / system.
I tried this because someone post that he can't displaying Chinese or Japanese character on a list box, but the OP already delete within a minute after he/she posted it (seem delete post often happens lately )
btw, work on my machine (tested) :
Code: | f = createForm()
lb = createListBox(f)
lb.Top = f.Top + 10
lb.Height = f.Height - lb.Top - 10
lb.Left = 10
lb.Width = f.Width - lb.Left - 10
lb.Items.Add('こんにちは, Japan')
lb.Items.Add('Բարեւ, Armenian')
lb.Items.Add('مرحبا, Arabic')
lb.Items.Add('你好, China')
lb.Items.Add('Здравствуйте, Russia')
lb.Items.Add('Χαίρετε, Greek')
f.show() |
Thanks
Description: |
|
Filesize: |
22.02 KB |
Viewed: |
8246 Time(s) |
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|