tried to use wstring in my terminal and see what happened.

Vladimir Panteleev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 30 20:18:55 PDT 2014


On Friday, 29 August 2014 at 22:01:58 UTC, Cassio Butrico wrote:
> Anyone help me...
>
> I am using the version for the windows dmd v 2.066
> to last I believe.
>
> tried to use wstring in my terminal and see what happened.
>
>     name =  cast(wstring)chomp(readln());

This line is incorrect. You are telling the compiler to interpret 
an UTF-8 byte stream as if it was UTF-16.

>     //name =  to!wstring(chomp(readln()));// with accent runtime
> error utf

This line is correct. If you are getting an UTF exception, that 
means that your terminal is not configured to use UTF-8. Your 
accent characters are probably encoded as an ASCII encoding, not 
UTF-8.

I see you're posting from a Windows machine. On Windows, to 
switch the terminal to UTF-8, type this command first:

chcp 65001

You can do this programmatically in your D program using 
SetConsoleCP and SetConsoleOutputCP. Note, though, that doing so 
can affect execution of your program from Windows batch files.


More information about the Digitalmars-d-learn mailing list