Parsing a UTF-16LE file line by line?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 5 13:35:30 PST 2017


On 1/4/17 6:03 AM, Nestor wrote:
> Hi,
>
> I was just trying to parse a UTF-16LE file using byLine, but apparently
> this function doesn't work with anything other than UTF-8, because I get
> this error:
>
> "Invalid UTF-8 sequence (at index 1)"
>
> How can I achieve what I want, without loading the entire file into memory?
>
> Thanks in advance.

I have not tested much with UTF16 and std.stdio, but I don't believe the 
underlying FILE * being used by phobos has good support for it.

In my testing, for instance, byLine with a non-ascii delimeter didn't 
work at all.

On Windows 64-bit, MSVC simply ignores any attempts to change the width 
of the stream.

I wouldn't hold out much hope for this to be fixed.

-Steve


More information about the Digitalmars-d-learn mailing list