https://issues.dlang.org/show_bug.cgi?id=6125
Lucia Cojocaru <lucia.mcojoc...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucia.mcojoc...@gmail.com --- Comment #3 from Lucia Cojocaru <lucia.mcojoc...@gmail.com> --- Is this a Windows specific bug? I tested the following on Linux 64: 1 import std.conv; 2 import std.stdio; 3 import std.utf; 4 5 void main() 6 { 7 auto x = to!string(cast(char)191); 8 auto z = toUTF8(x); 9 writeln(x); 10 11 12 foreach (y; 0 .. 16) 13 foreach (r; 0 .. 16) 14 { 15 auto buffer = to!string(cast(char)(16 * r + y)); 16 auto b = toUTF8(buffer); 17 writeln(b); 18 // auto result = buffer.toUTF16z; // call to utf16z for the winapi 19 } 20 } Only the commented line throws: core.exception.UnicodeException@src/rt/util/utf.d(292): invalid UTF-8 sequence --