On Japanese systems you will see that all references to the backslash
(e.g. paths in Explorer) will appear as a Yen sign. This also happens
when you type ALT 92 (the ASCII code of backslash). So, this is
apparently the preferred way of showing backslashes for this language.
My application also supports Japanese and its language resources are
loaded from a Unicode resource and then converted to ANSI string using
the current code page (since C++ builder currently not unicode capable).
All Japanese text displays just fine when using my application Japanese
systems.
My application also generates some path names that contain backslashes
and file handling using these path names works just fine (so the
generated path is ok). However, when I display these pathnames, I notice
that the backslash is actually displayed as backslash instead of the Yen
sign that is common for Japanese systems. I also have a Tmemo that
displays this information as backslashes. However, when I save the
content of the memo to a text file and then open it up in notepad, the
backslashes are displayed again as Yen signs.
So, the underlying character code appears to be just fine. It's just a
problem of how the actual character code gets rendered.
Any thoughts on this that can clarify this confusing behaviour are much
appreciated.
Kris
Note: Apparently something similar happens with Korean text where the
backslash is displayed as the WON sign.
While I can't offer you a solution (maybe somebody else knows a trick) I can
point you to some information I find. Apparently the backslash and yen
symbol have some ambiguity, and you are not the first to have this
problem -- I might be wrong but from what I'm seeing it appears that
whatever is rendering the text ends up having to make assumptions about
which one you want to see.
Here is a collection of information, some more useful than others:
http://www.google.com/search?hl=en&q=backslash+as+yen&btnG=Google+Search
What do you see with character 129 (0x81), out of curiosity? There is some
mention of it with CP932 here (ignore the poster's questionable attitude
towards Windows):
http://mail.nl.linux.org/linux-utf8/2002-01/msg00155.html
There is some relevant information here (which also concerns the Korean
won):
http://en.wikipedia.org/wiki/Backslash
"In the Japanese ISO 646 encoding (a 7-bit code based on ASCII), the code
point that would be used for backslash in ASCII is instead a yen mark (•),
while on Korean computer keyboards, the backslash corresponds to the won
symbol (? or W). Many Japanese environments nonetheless treat it like a
backslash, causing confusion.[7] To add to the confusion, some fonts, like
MS Mincho, render the backslash character as a •, so the Unicode characters
00A5 (•) and 005C (\) look almost identical when these fonts are selected."
Here is a link with a lot of information:
http://blogs.msdn.com/michkap/archive/2007/03/28/1972239.aspx
Each of the words "for a long time" there links to a different article
concerning the ambiguity.
Sorry I couldn't give you a solution but hopefully that sets you on the
right path.
Jason
Thanks for the info. Your feedback started me thinking and I managed to
track down the root cause of the problem.
Just creating a new application and displaying some backslashes works
just fine; the backslash is correctly displayed as Yen character.
However, when you do this:
Label1->Font->Name="Segoe UI";
You do get the Segoe font, but the backslashes in the label are now
displayed as actual backslashes instead of Yen symbols.
So, apparently explicitly assigning the font name causes the problem.
My project code contains code to differentiate between Windows XP and
Vista and assign fonts accordingly (respectively Tahoma and Segoe UI)
and since I'll be assigning the font name explicitly, I run into the
backslash problem.
So, at this point I'm unsure how to assign correct fonts depending on
the OS without running into any other problems. But at least I already
know what the source of these problems is.
Regards,
Kris
In fact, the problem is caused by a specific font (tested on Vista):
- Tahoma; works just fine and backslash is displayed as Yen.
- Segoe UI; doesn't work fine, the backslash is displayed as backslash
- Segoe; works just fine and backslash is displayed as Yen.
I find this behaviour somewhat strange. Since Segoe UI is the default
font for Windows applications I would have expected it to render to the
backslash correctly.
Furthermore, Windows Explorer, which I believe to also use the Segoe UI
font (just like all other apps do) does still display the backslashes as
Yen signs.
Kris