Hey guys, I've the following source:
module filereader; import std.file; import std.stdio : writeln; void main(string[] args) { File f = new File("myFile.ext", FileMode.In); while(!f.eof()) { writeln(convertToUTF8(f.readLine())); } f.close(); } string convertToUTF8(char[] text) { string result; for (uint i=0; i<text.length; i++) { wchar ch = text[i]; if (ch < 0x80) { result ~= ch; } else { result ~= 0xC0 | (ch >> 6); result ~= 0x80 | (ch & 0x3F); } } return result; } It compiles and works as long as the returned char-array/string of f.readLine() doesn't contain non-UTF8 character(s). If it contains such chars, writeln() doesn't write anything to the console. Is there any chance to read such files? Thanks a lot!