utf-8?

Daniel Keep daniel.keep.lists at gmail.com
Wed Mar 18 01:47:58 PDT 2009



Steve Teale wrote:
> Gide Nwawudu Wrote:
> 
>> On Tue, 17 Mar 2009 10:48:56 -0400, Steve Teale
>> <steve.teale at britseyeview.com> wrote:
>>
>>> import std.stdio;
>>>
>>> void main()
>>> {
>>>   string s = "Die Walk�re";
>>>   writefln(s);
>>> }
>>>
>>> Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
>> Works for me, you should save the file as UTF-8 and set your codepage
>> to 65001.
>> C:\> dmd test.d
>>
>> C:\> test
>> Die Walk+?re
>>
>> C:\>chcp 65001
>> Active code page: 65001
>>
>> C:\>test
>> Die Walk�re
>>
>> Gide
> 
> Yup, that does it. I'd missed the encoding option in notepad. What were you running the program in - in a cmd window I see graphics characters.

You have to configure CMD to use Lucida Console as the font.  Also note
that CMD won't do fallbacks like virtually every other Windows app: if a
character isn't in Lucida Console, you won't see it.

  -- Daniel



More information about the Digitalmars-d mailing list