Strange behavior in console with UTF-8
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 26 09:34:34 PDT 2016
On 3/25/16 6:47 PM, Jonathan Villa wrote:
> 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.
>>
>
> 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.
>
At this point, I think knowing exactly what input you are sending would
be helpful. Can you attach a file which has the input that causes the
error? Or just paste the input into your post.
-Steve
More information about the Digitalmars-d-learn
mailing list