Strange behavior in console with UTF-8

Jonathan Villa via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 25 15:47:08 PDT 2016


On Friday, 25 March 2016 at 13:58:44 UTC, Steven Schveighoffer 
wrote:
> On 3/24/16 8:54 PM, Jonathan Villa wrote:
>> [...]
>
> D's File i/o uses C's FILE * i/o system. At least on Windows, 
> this has literally zero support for wchar (you can set stream 
> width, and the library just ignores it).
>
> What is likely happening is that it is putting the char code 
> units into wchar buffer directly, which is not what you want.
>
> I am not certain of this cause, but I would steer clear of any 
> i/o that is not char-based. What you can do is read into a char 
> buffer, and then re-encode using std.conv.to to get wchar 
> strings if you need that.
>
> -Steve

It's the same Ali suggested (if I get it right) and the behaviour 
its the same.

It just get to send a UTF8 char to reproduce the mess, 
independently of the char type you send.

JV


More information about the Digitalmars-d-learn mailing list