Human stupidity or is this a regression?

Lionello Lunesu lionello at lunesu.remove.com
Wed Dec 25 19:48:38 PST 2013


Perhaps should have written "and/or" in the subject line since the two 
are not mutually exclusive.

I was showing off D to friends the other day:

import std.stdio;
void main()
{
   foreach (d; "你好")
     writeln(d);
}


IIRC, this used to work fine, with the variable "d" getting deduced as 
"dchar" and correctly reassembling the UTF-8 bytes into Unicode codepoints.

But when I run this code in OSX, dmd v2.064, I get this:

$ dmd -run uni.d
�
�
�
�
�
�

It's clearly printing the bytes. When I print the typeof(d) I get 
"immutable(char)", so that confirms the type is not deduced as "dchar".

I could have sworn this used to work. Is my memory failing me, or was 
this a deliberate change at some point? Perhaps a regression?

L.


More information about the Digitalmars-d-learn mailing list