digitalmars.D.learn - Printing wide characters in console
- Jun (14/14) Jan 07 2011 I think I found a solution for it. This code changes encoding of string ...
I think I found a solution for it. This code changes encoding of string to ansi which is default string encoding in windows console. import std.c.windows.windows; string ansi(string str) { wchar[] src = toUTF16(str).dup; char[] dest; dest.length = str.length; WideCharToMultiByte(0, 0, src.ptr, -1, dest.ptr, dest.length, null, null); return cast(string)dest; } It's inconvinient to call this function every time printing string, I think simillar code should be in the standard library.
Jan 07 2011