How to use readText to read utf16 file?

Domain via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 16 21:37:53 PST 2015


On Tuesday, 17 November 2015 at 03:12:47 UTC, Steven 
Schveighoffer wrote:
> On 11/16/15 10:00 PM, Adam D. Ruppe wrote:
>> On Tuesday, 17 November 2015 at 02:50:44 UTC, Domain wrote:
>>> Thanks! But how to remove BOM? Slice the result myself?
>>
>> Yeah. Do something like if(result.length &&result[0] == bom) { 
>> result =
>> result[1..$]; } and you'll have it.
>
> To be technically correct, you can do:
>
> if(!result.empty && result.front == bom) result.popFront();
>
> This should work for all 3 types of strings.
>
> -Steve

Thank you! Now another question: how to handle endianness?


More information about the Digitalmars-d-learn mailing list