Chinese characters in a string(GDC)

Carlos Santander csantander619 at gmail.com
Tue May 15 08:57:32 PDT 2007


Roberto Mariottini escribió:
> ryuka wrote:
> [...]
>> Anyway ,I try to change the code page to pthers.However ,When the d 
>> source stored in some other code pages , the compiler works well  (no 
>> compile errors ) but my application display strange characters which 
>> aren't the characters I type in the source .. and g++ programs display 
>> these strange characters too when using these code pages .So there is 
>> still a problem about using chinese on my os.
> 
> The problem is that the current D console API doesn't translate form 
> internal Unicode representation to the codepage currently selected in 
> your console.
> 
> So, even if you write your source as UTF-something (so the compiler can 
> understand it) when you call writef (or printf or the like) it will not 
> translate back those UTF sequences to the console codepage, so you'll 
> get messed up characters on the screen.
> 
> This makes D console programs currently unusable for any language other 
> than English.
> 
> Ciao

That's Windows-only. On Linux and Mac OS X, where the consoles use UTF-8, such 
characters show up correctly.

ryuka, you can use UTF-8 on Windows by using the Lucida Console font and doing 
"chcp 65001" (IIRC). Or you can convert your text to the local codepage before 
sending it to the console.

-- 
Carlos Santander Bernal



More information about the Digitalmars-d mailing list