reading UTF-8 formated file into dynamic array
csantander619 at gmail.com
Tue Jul 24 10:42:29 PDT 2007
> 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.
> 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.
That's just the nature of UTF-8 and how it's handled in D.
> (BOM is also contained in _input_.)
> So..., how I get a UTF-8 file properly mapped into an dynamic array?
std.stream contains a BOM Stream class or some such. Try that instead of
Carlos Santander Bernal
More information about the Digitalmars-d-learn