Asian characters are not printed propely in console

torhu no at spam.invalid
Wed Jan 5 13:07:15 PST 2011


On 04.01.2011 10:47, Jun wrote:
> I'm sorry for posting in the wrong place.
>
> I attached screenshot of my code and the result.
>
> As you can see, Korean letters get changed after compilation.
>
> This problem doesn't happen with user input(from readln() method).
>
> Should I use different type and prefix or suffix similary to C++?

If you save the file as utf-8, and set the console to CP 65001 (which is 
utf-8), it should work.  Providing your console font suppports the 
characters, of course.

You can add the suffixes 'w' or 'd' to get utf-16 or utf-32, 
respectively.  But then you need to save the file in that encoding, and 
change the console code page accordingly.  It all has to match up.

But I would expect it to work with other character sets too, as long as 
the file encoding and the console match.


More information about the Digitalmars-d-learn mailing list