Re: Using Japanese text with Delphi



"Andrew V. Fionik" <ender@xxxxxxxxxxxxxx> wrote in message
news:45e64d2f@xxxxxxxxxxxxxxxxxxxxxxxxx
Hello, all.

Recently my employer asked me to add support of Japanese text in
application. The first thing i'm tried is to create simple form with TEdit
on it and enter something in Japanese. I'm was able to enter Japanese text
however when i'm switched to another language - English all characters was
immediately corrupted. Also, as i understand TEdit can return only
non-unicode strings, but for Japanese we need unicode. What i need is to
correctly input, show, read and write Japanese characters. Reading/writing
from/into XML.

You have to go to Unicode, because then your characters will appear
correctly on any PC in the world. Its the standard, it works, forget code
pages.

The Japanese have the "@MS Mincho" font loaded - a Unicode font. Its on
your WinXP install disk somewhere. Or you can get the whole experience
including character entry by enabling XP for Asian Languages - its just a
Control Panel thing somewhere.

The Tnt Unicode controls are just about the only Delphi controls which can
display your Unicode font - and they are solid.

The Tnt controls have widestring properties instead of ordinary strings -
these are 2 bytes per character and represent the characters in the Unicode
Basic Plane. Windows will accept widestrings into the API functions which
end with 'W' - even though Windows 2000 and later are actually running a
somewhat different Unicode called UTF-16. I believe that 99.999% of the
time it won't matter, especially for Japanese.

Now comes the fun part. Your app now has to use Widestrings internally so
you have a lot of work to do. But how do you store those strings in text
files and databases? For text files, I recommend converting to UTF-8
Unicode format which looks OK in an ascii editor except when you encounter a
"foreign" character. You'll have to think through your database issues.

I had no trouble extending a smallish app to permit use with Japanese
characters - actually any Unicode Basic Plane characters.


Some links

http://fundementals.sourceforge.net/unicode.html

http://www.lischke-online.de/UnicodeLibrary.php

http://mh-nexus.de/unisynedit.htm

http://mh-nexus.de/unicodenotes.htm (Delphi Unicode notes- but confusing)

http://www.tntware.com/delphicontrols/unicode/


We are all waiting for CodeGear to give us a nice Delphi which runs Unicode
throughout, but for now this is how to do it.

Roger Lascelles


.



Relevant Pages

  • Re: SetThemeAppProperties and SetWindow Theme do not effect Unicode data handling
    ... I am quite sure that is not true that controls in Windows 2000 and on always ... the Windows multibyte codepages. ... national language characters in the upper half of the 256 character ... stopped working for our Japanese customers. ...
    (microsoft.public.win32.programmer.ui)
  • Re: Japanese XP themes
    ... OK, for the common controls, I've seen conflicting statements about which controls can handle Unicode and which can't. ... Even if your application is compiled for a Unicode environment, if you send a string to an ANSI control, the ANSI control is still going to depend on the system's default code page for non-Unicode applications. ... But on rereading your latest message, this doesn't seem to be your problem because you're taking some action when you detect that the system's default code page already is Japanese. ... The common controls ought to be OK already, those that run in Unicode should continue running in Unicode, and those that run in Shift-JIS should continue running in Shift-JIS. ...
    (microsoft.public.vc.mfc)
  • =?utf-8?B?UmU6IM6lzqDOn86azpXOmc6czpXOnc6fzp0gKFNVQkpFQ1Qp?=
    ... See this article about a similar problem with Japanese ... Japanese Characters in the Subject Line of E-Mail Message Appear As ... > Subject line as the operating system fully support Unicode. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Need help with CABWIZ
    ... Just a slight clarification - Unicode doesn't simply include Japanese ... characters - it can support them, but having Unicode doesn't simply give you ... on what I've seen, it doesn't have provision for non ANSI characters, as the ...
    (microsoft.public.pocketpc.developer)
  • Re: Best encoding for a Japanese web site to deliver?
    ... >and the prophet was numbered among those called Timmy Douglas. ... >> The problem with using a unicode based encoding is that the unicode ... >> likely get an ugly display of characters. ... fostered by a few anti-Unicode Japanese people. ...
    (sci.lang.japan)