Welcome, Guest
Please Login or Register.    Lost Password?

[Solved] About Rainlendar_SetItemValue()
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: [Solved] About Rainlendar_SetItemValue()
#14420
Re:About Rainlendar_SetItemValue() 3 Years, 8 Months ago  
The problem probably is that the lua function os.date() returns the value always encoded with your current code page. So, if you concatenate that with the utf-8 encoded string there are two different encodings in the same strings and Rainlendar doesn't know how to decode it (ain't text encoding fun .

I tried to change my locale settings to Traditional Chinese but I can't make the "%a" to return anything else but English and Finnish for some reason. But you can try to solve the problem like this:

sTime = "Chinese characters go here" .. Rainlendar_ConvertString(os.date("%x %a"), "big5")

The "big5" should be the code page for your current locale. If the "big5" doesn't work you can also try "950" as the code page as that's what Windows calls it.
Rainy
Moderator
Posts: 6000
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#14422
Re:About Rainlendar_SetItemValue() 3 Years, 8 Months ago  
Thank you Rainy, this problem is solved on my pc.
But, if i want the .lua file can applicable to all languages OS,
How can i do?

This is my current method:
In lua file only write s = "Chinese language strings"
And add <time format="%x %a" ...... /> in my_skin.xml
anoob
Platinum Boarder
Posts: 504
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
Last Edit: 2011/02/05 10:51 By anoob.
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
#14429
Re:About Rainlendar_SetItemValue() 3 Years, 8 Months ago  
Rainlendar will try to convert the string with the user's current codepage if the utf-8 conversion fails so something like this should change the encoding from local to utf-8:

sTime = os.date("%x %a")
Rainlendar_SetItemValue("LunarCal", "LunarCal.info", "text", sTime)
sTime = Rainlendar_GetItemValue("LunarCal", "LunarCal.info", "text")
Rainlendar_SetItemValue("LunarCal", "LunarCal.info", "text", "Chinese text" .. sTime)
Rainy
Moderator
Posts: 6000
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#14432
Re:About Rainlendar_SetItemValue() 3 Years, 8 Months ago  
It's working correctly.
Thanks!
anoob
Platinum Boarder
Posts: 504
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: TaiChung, Taiwan, R.O.C. Birthday: 02/12
The administrator has disabled public write access.
I couldn't speak English! This skin released to Customize.org(Do you want it? Click Picture) Please contact me if interested: jhg5702@gmail.com
 
Go to topPage: 12
get the latest posts directly to your desktop