Adding Unicode operators to D

Sergey Gromov snake.scaly at gmail.com
Mon Oct 27 19:39:39 PDT 2008


Bill Baxter пишет:
> On Sat, Oct 25, 2008 at 10:37 AM, Benji Smith <dlanguage at benjismith.net> wrote:
>> Bill Baxter wrote:
>>> On Sat, Oct 25, 2008 at 10:23 AM, Benji Smith <dlanguage at benjismith.net>
>>> wrote:
>>>> Bill Baxter wrote:
>>>>>>> Anyone using a shell for Windows that works and supports UTF-8
>>>>>>> properly?
>>>>>> A regular Windows console supports UTF-8 to some extent:
>>>>>>
>>>>>> * Change console font to Lucida Console
>>>>>> * issue "chcp 65001"
>>>>>>
>>>>>> You can even get more fonts into there with a bit of hackery.
>>>>> I did that but "type <filewith-utf8.txt>"  still prints garbage.
>>>> That's weird. My machine (WinXp Sp3) has no problem printing UTF-8 to the
>>>> console. The only special thing I did was changed the font to Lucide
>>>> Console.
>>> Ok.  Thanks for the info.  Knowing that it has actually worked for at
>>> least one person gives me motivation to try again.
>>>
>>> --bb
>> Write a tiny little D program and see what you get on the console:
>>
>>   import tango.io.Stdout;
>>   void main() {
>>      Stdout("spade, club, heart, diamond: \u2660\u2663\u2665\u2666");
>>   }
>>
>> I don't know anything about the "type" command, and whether it supports
>> UTF-8. But the console itself ought to be able to handle it. Try compiling
>> the above code and see what happens.
>>
>> --benji
> 
> Ah, I see.  I guess more what I want to know is if I had utf-8 source
> code and the D compiler spit out a message about one of the lines,
> would that error message come out as garbage?  Same for ddbg -- if I'm
> debugging and say "ps" for "print source" will the result be garbage.
>   I was thinking that "type" would be a simple test if that sort of
> thing would work.
> 
> But maybe type is just borked.  I did try "cat" and "more" too I
> think, with same result, though.

They all work for me: type, cat, less.  The file is UTF-8 with BOM. 
Error messages are printed correctly displaying all the characters in a 
buggy symbol.

But now I remember.  It fails to execute any  batch files when it's in 
65001 codepage.  More precisely, it executes exactly one line from a 
batch file like if there were no more lines.  So this pseudo-uniclde 
mode is useless.


More information about the Digitalmars-d-announce mailing list