digitalmars.D.learn - euro sign
- nobody (18/18) May 06 2009 Hello,
- Sivo Schilling (19/42) May 06 2009 Hi
- Frank Benoit (8/58) May 07 2009 The windows console is by default adjusted to your local codepage. It
Hello, import std.stdio; void main() { wchar w_sonderzeichen= '\u20ac'; // Euro Zeichen writef("w_sonderzeichen = %s ",w_sonderzeichen) ; } capri capri-desktop:~/dd$ dmd utf_test.d /home/capri/dd/dmd/src/phobos/std/stdio.d(823): Error: undefined identifier backend /home/capri/dd/dmd/src/phobos/std/stdio.d(823): Error: function std.stdio.fputc_unlocked (int, _iobuf*) does not match parameter types (wchar,int) /home/capri/dd/dmd/src/phobos/std/stdio.d(823): Error: cannot implicitly convert expression (backend) of type int to _iobuf* /home/capri/dd/dmd/src/phobos/std/stdio.d(830): Error: undefined identifier backend /home/capri/dd/dmd/src/phobos/std/stdio.d(830): Error: function std.stdio.fputc_unlocked (int, _iobuf*) does not match parameter types (char,int) /home/capri/dd/dmd/src/phobos/std/stdio.d(830): Error: cannot implicitly convert expression (backend) of type int to _iobuf* /home/capri/dd/dmd/src/phobos/std/stdio.d(835): Error: undefined identifier backend /home/capri/dd/dmd/src/phobos/std/stdio.d(835): Error: function std.stdio.fputwc_unlocked (dchar, _iobuf*) does not match parameter types (wchar,int) /home/capri/dd/dmd/src/phobos/std/stdio.d(835): Error: cannot implicitly convert expression (backend) of type int to _iobuf* /home/capri/dd/dmd/src/phobos/std/stdio.d(1982): Error: template instance std.stdio.File.LockingTextWriter.put!(wchar) error instantiating DMD 2.029 under linux
May 06 2009
nobody Wrote:Hello, import std.stdio; void main() { wchar w_sonderzeichen= '\u20ac'; // Euro Zeichen writef("w_sonderzeichen = %s ",w_sonderzeichen) ; } capri capri-desktop:~/dd$ dmd utf_test.d /home/capri/dd/dmd/src/phobos/std/stdio.d(823): Error: undefined identifier backend /home/capri/dd/dmd/src/phobos/std/stdio.d(823): Error: function std.stdio.fputc_unlocked (int, _iobuf*) does not match parameter types (wchar,int) /home/capri/dd/dmd/src/phobos/std/stdio.d(823): Error: cannot implicitly convert expression (backend) of type int to _iobuf* /home/capri/dd/dmd/src/phobos/std/stdio.d(830): Error: undefined identifier backend /home/capri/dd/dmd/src/phobos/std/stdio.d(830): Error: function std.stdio.fputc_unlocked (int, _iobuf*) does not match parameter types (char,int) /home/capri/dd/dmd/src/phobos/std/stdio.d(830): Error: cannot implicitly convert expression (backend) of type int to _iobuf* /home/capri/dd/dmd/src/phobos/std/stdio.d(835): Error: undefined identifier backend /home/capri/dd/dmd/src/phobos/std/stdio.d(835): Error: function std.stdio.fputwc_unlocked (dchar, _iobuf*) does not match parameter types (wchar,int) /home/capri/dd/dmd/src/phobos/std/stdio.d(835): Error: cannot implicitly convert expression (backend) of type int to _iobuf* /home/capri/dd/dmd/src/phobos/std/stdio.d(1982): Error: template instance std.stdio.File.LockingTextWriter.put!(wchar) error instantiating DMD 2.029 under linuxHi the error messages are the same on Windows XP. The problem seems to be the type of 'w_sonderzeichen'. If you change the type from wchar to dchar then dmd is happy and at least on linux you see the Euro sign (on Windows console output is not very useful). Chears, Sivo. --- import std.stdio; void main() { dchar w_sonderzeichen = '\u20ac'; // Euro Zeichen writefln("w_sonderzeichen = %s ", w_sonderzeichen) ; } --- Output: w_sonderzeichen = €
May 06 2009
Sivo Schilling schrieb:nobody Wrote:The windows console is by default adjusted to your local codepage. It can be set to be utf8 with the shell command "chcp 65001" or your program can do that with "SetConsoleCP( CP_UTF8 );" In Tango programs this is done by default, afaik. The compile errors you see seems like a implementation bug in phobos to me. You can also use char[] instead of dchar, char[] w_sonderzeichen = "\u20ac";Hello, import std.stdio; void main() { wchar w_sonderzeichen= '\u20ac'; // Euro Zeichen writef("w_sonderzeichen = %s ",w_sonderzeichen) ; } capri capri-desktop:~/dd$ dmd utf_test.d /home/capri/dd/dmd/src/phobos/std/stdio.d(823): Error: undefined identifier backend /home/capri/dd/dmd/src/phobos/std/stdio.d(823): Error: function std.stdio.fputc_unlocked (int, _iobuf*) does not match parameter types (wchar,int) /home/capri/dd/dmd/src/phobos/std/stdio.d(823): Error: cannot implicitly convert expression (backend) of type int to _iobuf* /home/capri/dd/dmd/src/phobos/std/stdio.d(830): Error: undefined identifier backend /home/capri/dd/dmd/src/phobos/std/stdio.d(830): Error: function std.stdio.fputc_unlocked (int, _iobuf*) does not match parameter types (char,int) /home/capri/dd/dmd/src/phobos/std/stdio.d(830): Error: cannot implicitly convert expression (backend) of type int to _iobuf* /home/capri/dd/dmd/src/phobos/std/stdio.d(835): Error: undefined identifier backend /home/capri/dd/dmd/src/phobos/std/stdio.d(835): Error: function std.stdio.fputwc_unlocked (dchar, _iobuf*) does not match parameter types (wchar,int) /home/capri/dd/dmd/src/phobos/std/stdio.d(835): Error: cannot implicitly convert expression (backend) of type int to _iobuf* /home/capri/dd/dmd/src/phobos/std/stdio.d(1982): Error: template instance std.stdio.File.LockingTextWriter.put!(wchar) error instantiating DMD 2.029 under linuxHi the error messages are the same on Windows XP. The problem seems to be the type of 'w_sonderzeichen'. If you change the type from wchar to dchar then dmd is happy and at least on linux you see the Euro sign (on Windows console output is not very useful). Chears, Sivo. --- import std.stdio; void main() { dchar w_sonderzeichen = '\u20ac'; // Euro Zeichen writefln("w_sonderzeichen = %s ", w_sonderzeichen) ; } --- Output: w_sonderzeichen = €
May 07 2009