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

Cassio Butrico via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 30 20:54:35 PDT 2014


On Sunday, 31 August 2014 at 03:18:57 UTC, Vladimir Panteleev 
wrote:
> 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.
Thank you for answering me so fast, I'm happy.
I'll set the output of my terminal, and redo some tests.
again thank you for your help.
I was creating a way of resolveir this, create a repositoio up.
https: //cassio_butrico at bitbucket.org/cassio_butrico/dic.git


More information about the Digitalmars-d-learn mailing list