wxWidgets xrc system is based on expat. expat do not support east asia language, such as Chinese, Korean...
For example, if using a Chinese string as a button caption in resource file,when the resource file was parsed and corresponding button was displayed, the Chinese string was changed into some un-recognizable characters.
How to fix this?
Many thanks!
How to make XRC resources to support east asia language?
yes,I'm using Unicode mode.Avi wrote:I have a bit offtopic question, if you use wxWidgets (and therefor xrc as well) in Unicode mode, would it still not support east asian languages? I mean, doesn't Unicode natively supports all these languages?
It looks as if expat or xrc system has done something "special" to change the characters,but obviously this special things is not welcomed by asian language. I don't know what expat or wxWidgets xrc system has done under the table, for I havn't dug into their source codes yet. I just hope I can find a solution here , then I havn't need to study their long long codes...
I succeed used chinese string in xrc file
First: Convert the xrc file from ASCII to UTF-8;
Second: Replaced the first line of the XRC file with"<?xml version="1.0" encoding="UTF-8"?>" (or only change the encoding)
Three: either the normal or the unicode compile is ok.
Good Luck!
Second: Replaced the first line of the XRC file with"<?xml version="1.0" encoding="UTF-8"?>" (or only change the encoding)
Three: either the normal or the unicode compile is ok.
Good Luck!
-
- Part Of The Furniture
- Posts: 1511
- Joined: Sun Jun 19, 2005 11:37 am
- Location: Singapore
- Contact:
OK this sounds PARTIALLY weird, but just so you know (because I come from Web programming background aswell) there are escape codes to get your characters - look carefully for those that start with &xxxx; where xxxx is a code to represent your character.
If expat is coded to specification, it should know what the escape code means...
If expat is coded to specification, it should know what the escape code means...
I think you must call
wxXmlResource::Get()->SetFlags(0);
before wxXmlResource::Get()->Load(...) because you must disable the wxXRC_USE_LOCALE flag if non US-Ascii is used in xrc-file.
See:
http://www.wxwidgets.org/faqcmn.htm#xrclocale
wxXmlResource::Get()->SetFlags(0);
before wxXmlResource::Get()->Load(...) because you must disable the wxXRC_USE_LOCALE flag if non US-Ascii is used in xrc-file.
See:
http://www.wxwidgets.org/faqcmn.htm#xrclocale
Last edited by GeraldG on Mon Sep 05, 2005 1:08 pm, edited 2 times in total.
I apologize to lowjoel for my mistakes,"Replaced the first line of the XRC file with""" should be "Replaced the first line of the XRC file with" "(I tried on my machine:xp pro cn, vc 71 cn, wxwidgets 2.6.0) ;
BTW:I tried "wxXmlResource::Get()->SetFlags(0); " before , but it seem to no effort to me.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
BTW:I tried "wxXmlResource::Get()->SetFlags(0); " before , but it seem to no effort to me.
I do things as you said. but wxWidgets xrc still can't handle Chinese words right. Are you sure you sample works?naef_wy wrote:I apologize to lowjoel for my mistakes,"Replaced the first line of the XRC file with""" should be "Replaced the first line of the XRC file with""(I tried on my machine:xp pro cn, vc 71 cn, wxwidgets 2.6.0) ;Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
BTW:I tried "wxXmlResource::Get()->SetFlags(0); " before , but it seem to no effort to me.
I've dug into the wxXmlResource code, and i found that wxXmlResource::Get()->SetFlags(0) together with naef_wy's way works.naef_wy wrote:I apologize to lowjoel for my mistakes,"Replaced the first line of the XRC file with""" should be "Replaced the first line of the XRC file with""(I tried on my machine:xp pro cn, vc 71 cn, wxwidgets 2.6.0) ;Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
BTW:I tried "wxXmlResource::Get()->SetFlags(0); " before , but it seem to no effort to me.