convert odstring to unicode
convert odstring to unicode
hi,
we receive a drawing created with a chinese autocad: save_with_acad_cn.dwg
we open this drawing and save it with our autocad: save_with_acad_fr.dwg
when i open save_with_acad_cn.dwg with dwgdirect 1.14.01, the textstring return by oddbtext::textstring() is: ¨ú®ø
when i open save_with_acad_fr.dwg with dwgdirect 1.14.01, the textstring return by oddbtext::textstring() is: \m+2a8fa\m+2aef8
our application is unicode and we want to display chineses caracters. i try to understand how does autocad do to convert unicode string, but it's to complicated.
please help me !
where can i find a function to convert the first string (¨ú®ø

and the second string (\m+2a8fa\m+2aef8) to two chineses caractères and display it in my editbox ?
attached files
i understand why in the chinese drawing caracters are display as
code:
¨ú®ø
and in my drawing they are display as
code:
\m+2a8fa\m+2aef8
.
it's because they don't have the same codepage.
how can i do to change the codepage of a drawing ? is it possible ?
in the first case you get multibyte string and you know codepade, so you may easily convert it to unicode via e.g. multibytetowidechar
in the second case you get unicode string (encoded as \m+ or \u+)
vladimir
if you set ballowcpconversion to true in readfile() dwgdirect will convert drawing to code page returned by oddbsystemservices::systemcodepage().
characters which can't be converted to this code page will be represented as \u+xxxx or \m+xxxxx.
to convert a code page string to unicode you can use oddbtextiterator class (dbtextiterator.h)
it will process the special character sequences.
sergey slezkin
thank you sergey, you realy help me !
if i set ballowcpconvertion to true, i have the same thing in the chinese drawing and in my drawing.
now i am trying to convert cis to unicode and unicode to cis.
i found txt::transformunicode in importcallbacks.cpp, convert unicode string to cis, it works.
and i use odnameiteratortemp (in dwf2dc.cpp) to convert cis to unicode, but it doesn't works with save_with_acad_fr.dwg.
code:
\m+2a8fa\m+2aef8
become: ꣺껸
need to be: 取消
i try with oddbtextiterator but i have the same result.
is there a reason ?
more...
if i change the textstyle of standard textstyle (set usebigfont to false) and if i use oddbtextiterator, it works !
why oddbtextiterator doesn't works when the textstyle use bigfont ?
text iterator uses font information. for multibyte code pages it needs bigfont data.
sergey slezkin
txt::transformunicode convert an unicode string to cif (\u+xxxx)
where can i found an example of converting unicode to mif (\m+nxxxx)? is it possible ?
regards.