print non-ASCII/UTF-8 string
Egor Starostin
egorst at gmail.com
Fri Dec 22 06:29:07 PST 2006
Let's say that file q.txt contains some characters bigger than 0x7f (for
example, from windows-1252 encoding).
In such case the following snippet:
***
import std.stream;
void main() {
Stream f = new BufferedFile("q.txt");
for (char[] l; f) {
writefln(l);
}
}
***
will fail with 'Error: 4invalid UTF-8 sequence' because D's strings are in
UTF-8, right?
My question is: is there any way to print out non-UTF-8 data exactly in the
same encoding (which may be unknown) as in original file?
More information about the Digitalmars-d
mailing list