Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

UNICODE -> ANSI | CodePage problem

2 views
Skip to first unread message

Markus Eßmayr

unread,
Mar 6, 2007, 6:47:10 AM3/6/07
to
Hello!

I have an application, that internally uses ANSI-encoding for strings.
In an external module, I work with UNICODE-strings and so I have to convert
them to ANSI when passing them back to the application.

When I work with characters for Czech an Croatian language I have a problem.
The UNICODE-character 0x010d (c) should be translated to the according
character in the codepage 1250 which there is 0xe8.

When I call WideCharToMultiByte in my module, it translates the character to
the right ANSI-code BUT its displayed using the codepage 1252 where this
character is (è) instead of (c).
When debugging my module, the character is displayed correctly just before
returning to the calling aNSI app.

Another BUT: When I mark the wrong character in the app, and copy it to a
new mail in my Lotus Notes client, the è transforms correctly to a c !?!?
I'm really confused now!

Has anyone any ideas, what might cause that behaviour and what I could do to
make the ANSI app use the correct codepage?

Thank you very very much in advance!
Max


Christian Kaiser

unread,
Mar 7, 2007, 6:29:01 AM3/7/07
to
a) better: ms.public.win32.programmer.international

b) > When I call WideCharToMultiByte in my module, it translates the

character to
> the right ANSI-code BUT its displayed using the codepage 1252 where this
> character is (è) instead of (c).

Quite normal, depending on your locale.

Thing is, a byte (0xe8) is language neutral - it's just a byte. By itself,
it does not mean anything.

It becomes a glyph (visual representation) only when you want to show it,
and it will be converted by the system codepage into the glyph unless you
are able to specify a different codepage. If you control the ANSI app, tell
it to use codepage 1250. If you don't, it will only display czech/croatian
in an OS set to one of these languages, and any other visual representation
according to the codepage.

That's what a codepage is: a translation of a byte value into a visual
representation.

Christian


0 new messages