digitalmars.D - stdio.writef \u00a3
- John C (5/5) Feb 10 2006 Anyone know why stdio.writef doesn't display the pound sign on Windows?
- Deewiant (14/23) Feb 10 2006 import std.stdio;
- pragma (6/9) Feb 10 2006 Well, that brings up an interesting point: shouldn't D be granted someth...
- Sean Kelly (7/17) Feb 10 2006 I've been thinking it might simply make sense to use the wide version of...
- Lars Ivar Igesund (3/32) Feb 10 2006 cmd.exe handles unicode if you tell it to, but that isn't necessarily ea...
- John C (5/34) Feb 10 2006 Ah, and wprintf("\u009C") actually displays the pound sign £. Apparently...
Anyone know why stdio.writef doesn't display the pound sign on Windows? Using "\u00A3" or "\£" results in what looks like garbage. The .NET Console class handles the character correctly. The latter uses GetStdHandle instead of stdout - perhaps that's something to do with it. Short of writing my own console class, are there any workarounds?
Feb 10 2006
John C wrote:Anyone know why stdio.writef doesn't display the pound sign on Windows? Using "\u00A3" or "\£" results in what looks like garbage. The .NET Console class handles the character correctly. The latter uses GetStdHandle instead of stdout - perhaps that's something to do with it. Short of writing my own console class, are there any workarounds?import std.stdio; void main() { writef("\u00A3"); } Works fine for me. However, it displays "£" in cmd.exe since the shell can't handle Unicode. I think it uses windows-1252 or something as its codepage.* Anyhoo, if you direct the output to a text file you get a UTF-8 file with the pound sign, £, in it. I guess the .NET Console class internally converts to cmd.exe's encoding -if try to output something more exotic, like "\u3050", I don't think it should work even there. * "echo £" to a file and it gives the byte "9C". Beats me what encoding this is, but it sure ain't ISO or UTF ;)
Feb 10 2006
In article <dsiepe$19q8$1 digitaldaemon.com>, Deewiant says...I guess the .NET Console class internally converts to cmd.exe's encoding -if try to output something more exotic, like "\u3050", I don't think it should work even there.Well, that brings up an interesting point: shouldn't D be granted something similar, as to make unicode more universal in console apps? Perhaps something that lurks behind writef() that translates from various UTF encodings into the native codepage? - Eric Anderton at yahoo
Feb 10 2006
pragma wrote:In article <dsiepe$19q8$1 digitaldaemon.com>, Deewiant says...I've been thinking it might simply make sense to use the wide version of all i/o functions behind the scenes. In fact, Windows even supports a "wmain" function that passes input parameters in as Unicode. Using these would be a heck of a lot easier than trying to convert to/from C code pages manually. SeanI guess the .NET Console class internally converts to cmd.exe's encoding -if try to output something more exotic, like "\u3050", I don't think it should work even there.Well, that brings up an interesting point: shouldn't D be granted something similar, as to make unicode more universal in console apps? Perhaps something that lurks behind writef() that translates from various UTF encodings into the native codepage?
Feb 10 2006
Deewiant wrote:John C wrote:cmd.exe handles unicode if you tell it to, but that isn't necessarily easy to do.Anyone know why stdio.writef doesn't display the pound sign on Windows? Using "\u00A3" or "\£" results in what looks like garbage. The .NET Console class handles the character correctly. The latter uses GetStdHandle instead of stdout - perhaps that's something to do with it. Short of writing my own console class, are there any workarounds?import std.stdio; void main() { writef("\u00A3"); } Works fine for me. However, it displays "£" in cmd.exe since the shell can't handle Unicode. I think it uses windows-1252 or something as its codepage.* Anyhoo, if you direct the output to a text file you get a UTF-8 file with the pound sign, £, in it. I guess the .NET Console class internally converts to cmd.exe's encoding -if try to output something more exotic, like "\u3050", I don't think it should work even there. * "echo £" to a file and it gives the byte "9C". Beats me what encoding this is, but it sure ain't ISO or UTF ;)
Feb 10 2006
"Deewiant" <deewiant.doesnotlike.spam gmail.com> wrote in message news:dsiepe$19q8$1 digitaldaemon.com...John C wrote:Ah, and wprintf("\u009C") actually displays the pound sign £. Apparently the code page is called Western European (DOS). The Console class does, indeed, adjust its output internally to the console's code page.Anyone know why stdio.writef doesn't display the pound sign on Windows? Using "\u00A3" or "\£" results in what looks like garbage. The .NET Console class handles the character correctly. The latter uses GetStdHandle instead of stdout - perhaps that's something to do with it. Short of writing my own console class, are there any workarounds?import std.stdio; void main() { writef("\u00A3"); } Works fine for me. However, it displays "?ú" in cmd.exe since the shell can't handle Unicode. I think it uses windows-1252 or something as its codepage.* Anyhoo, if you direct the output to a text file you get a UTF-8 file with the pound sign, £, in it. I guess the .NET Console class internally converts to cmd.exe's encoding -if try to output something more exotic, like "\u3050", I don't think it should work even there. * "echo £" to a file and it gives the byte "9C". Beats me what encoding this is, but it sure ain't ISO or UTF ;)
Feb 10 2006