高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】odstring unicodemif behaviour on pc and mac
odstring unicode/mif behaviour on pc and mac
odstring unicode/mif behaviour on pc and mac
hi everybody,
i create an odstring from katakana characters from the codepage ansi 932 like below:
const char characters[9] = { 0x83, 0x4f, 0x83, 0x8b, 0x81, 0x5b, 0x83, 0x76, 0x00 };
odstring string(characters, cp_ansi_932);
const odchar * unicode = string.c_str(); // unicode buffer
const char * ansi = static_cast<const char *>(string); // ansi buffer
on the pc "ansi" contains the "characters" above and "unicode" contains the utf-16 codes 0x30b0 ...
on the mac "ansi" and "unicode" contains the mif representation \m+1834f ...
why is the behaviour on the pc and mac different?
is it possible to get the same behaviour from the pc on the mac?
thanks a lot.
hello speed,
you need initialize codepage convertion table for cp_ansi_932 on the mac. see for example
and
best regards,
sergey z.
i am reading a dxf file with oddbdocument::readfile and in the dxf file there are strings encoded in ansi 932. all strings from the dxf file will be stored in an odstring by the opendwg library.
i thought odstring is handling all the code page issues and returns me an unicode string on pc and mac.
how should i initialize codepage conversion to cp_ansi_932 when the information which codepage is used,
is buried somewhere in the dxf file. with a different file, it could be a different codepage.
i might probably misunderstood something here.
i am still wondering why the behaviour is different on the pc and mac.
thanks,
ralf
hello ralf,
codepage conversion works properly when odcodemapper class is initialize.
you have to do it once during start application.
for example:
#include "odcharmapper.h"
...
void main(...)
{
odcharmapper::initialize("c:\\adinit.dat");
...
}
file "adinit.dat" you can find in c dwg library (open dwg toolkit).
also use searching with "adinit.dat" on forum for more information.
best regards,
sergey z.
hello sergey,
thank you very much for your help. i got it running on mac os x now besides the following:
i am calling readfile with an odstring storing a fullpath to a dxf file "む.dxf" where one character is
the unicode character 0x3080 but readfile never returns and hangs forever. the exactly same dxf
file e.g. "a.dxf" with all ascii characters and no unicode characters works just fine.
this happens on mac os x with dwgdirect library 2.05.01, 2.06.03, 2.07.01. its fine on win32.
am i still missing something.
thanks a lot.
ralf
hello sergey,
do you have any information about the problem, i have described below.
this is very important for our customer.
thanks,
ralf
hello ralf,
it seems where is problem with system create file. try to chech your implementation oddbsystemservices::createfile() method.
best regards,
sergey z.
|