reading UTF-8 formated file into dynamic array

thofis thofis at gmail.com
Tue Jul 24 08:19:50 PDT 2007


Hi,

I try to read a text file into a dynamic array but got stucked with non
ASCII characters. While trying I looked at the word count example.
(http://www.digitalmars.com/d/wc.html)

Basicly there's used:
char[] input;
// read file into input[]
input = cast(char[])std.file.read(args[i]);

But it seems that this casting does not result in proper filling of
_input_. Any non ACSII character is splited into multiple characters.
(BOM is also contained in _input_.)

So..., how I get a UTF-8 file properly mapped into an dynamic array?

TIA

Bye


More information about the Digitalmars-d-learn mailing list