different rendering of text between japanese and english os
different rendering of text between japanese and english os windows xp
hello
i have problem with rendering text at the japanese windows - reading dxf file.
string is \u+3072\u+3068\u+3064\u+3084\u+3063\u+3066\u+307f\ u+3088\u+3046
code page in a dxf file ia ansi_1252
very simpele code i am using:
odstring str(pdiment->dimensiontext(),pdb->getdwgcodepage());
and results are:
1) at english windows is ok, string is
ansistring "\u+3072\u+3068\u+3064\u+3084\u+3063\u+3066\u+307f \u+3088\u+3046" and this is ok, because code_page in not 932 and this text is japanese
unicodebuffer contain correct unicode string and i can see him
2) at japanese windows results are not ok
ansistring "?#272;?#262;偮傗偭偰傒?#263;偆"
unicodebuffer "?侫偮傗偭偰傒俛偆
these strings at ansi and unicode buffer form my side does not look like at anything seems like my japanese string.
can somebody explan to me these differences between japanese and english and generaly what dwgdirect++ library checking at different operation systems. i didnt check any other windows, like germany locale windows xp, like croatian windows xp locale, serbian, rusian..., this is all locale unicode supported.
best regards
ervin
hello ervin,
odstring str(pdiment->dimensiontext(),pdb->getdwgcodepage());
this constructor definition is
odstring:

dstring(const char* str, odcodepageid codepage)
so
1. pdiment->dimensiontext() is converted to multi byte with system code page (more exactly cp_thread_acp)
2. this multi byte string with pdb->getdwgcodepage() is used for initialize variable "str".
pdiment->dimensiontext() returns odstring so it must be in unicode.
test next str
odstring str(pdiment->dimensiontext());
is unicode right in both locale (japanese and english)?
test next strings
odansistring ansistr932(str, cp_ansi_932); // must be multibyte
odansistring ansistr1252(str, cp_ansi_1252); // must be \u+xxxx notation
best regards,
sergey z.
hello sergey
i checked again with your proposal, but i have same thing, something do not work correct at japanese winxp.
i need correct unicode buffer that i can operate with strings in my application.
what i have from dwgdirect at japane winxp is wrong wrong.
i changed my code to:
odansistring ansistr(pdiment->dimensiontext(),cp_ansi_1252);
odstring str(ansistr);
and i have for a string
1) at english winxp
"\u+3072\u+3068\u+3064\u+3084\u+3063\u+3066\u+ 307f \u+3088\u+3046"
2) at japanese winxp
"?#272;?#262;偮傗偭偰傒?#263;偆" - this is garbage
i remaind that my dxf file has a dimension texts (japanese and german) and has for code_page ansi_1252.
with this code page, all japanese texts must to have u+xxxx notation in a ansi buffer of odstring, german (umalut) chars must have original value in ansi buffer of odstrinig, because german chars are in range of ansi_1252, and everything have to work same at both of operations systems (janapese and english winxp).
can you please check this issue, becuse, it is urgen for my customers.
i attached dxf file.
best regards
ervin
attached files (46.3 kb, 3 views)
hello ervin,
quote:
2) at japanese winxp
"??????#8218;?#8218;?#8218;?#8218;?#8218;???quot; - this is garbage
it is seems correct multi byte value (in cp 932) for unicode srting (\u+xxxx...). (hex format would be more suitable.)
it very strange what you get this with code page 1252 (odansistring ansistr(pdiment->dimensiontext(),cp_ansi_1252)).
what version dwgdirect do you use?
i am getting at both of operations systems (janapese and russian winxp).
odansistring ansstr(str, cp_ansi_932); // "??????#8218;?#8218;?#8218;?#8218;?#8218;???quot;
odansistring ansstr1(str, cp_ansi_1252); // u+xxxx
if i understand right you need to get ansi text string from pdiment->dimensiontext().
note
this two lines have no sence:
odansistring ansistr(pdiment->dimensiontext(),cp_ansi_1252);
odstring str(ansistr);
and it may be changed to ( no need any conversion)
odstring str(pdiment->dimensiontext());
best regards,
sergey z.
last edited by sergey z.; 25th january 2008 at 07:23 amfff">.
hello sergey.
ok, i understand, what you tell me.
my question is:
why at jap winxp in ansi buffer i have multibyte representation of string and at eng winxp i have \u+xxxx in ansi buffer of odstring class for a same text. unicode buffer is ok at the both of operations systems.
in dxf file is a ansi_1252 code page. is there a way how can i have always same ansi buffer at the different operations sistem, or any triks or something else !?
best regards
ervin
hello ervin,
i am not able to reproduce your situation. i have always same ansi buffer at the different operations sistem. so possible you use not last version dwgdirect.
note. try to check code page pdb->getdwgcodepage(). in case it is equal cp_undefined it is used system code page in conversion.
best regards,
sergey z.