www.digitalmars.com         C & C++   DMDScript  

D - dmd bugs on string

reply jmchxy 163.com writes:
help me!
I'm a Chinese programmer, a C++ programmer  and a new member for D. 

bugs:

/*
hello.d
*/

int main(char[][] args)
{
printf("!\n");
return 0;
}

save as ascii or utf8:

dmd output:

hello.d(3): invalid UTF-8 sequence
hello.d(3): invalid UTF-8 sequence
hello.d(3): invalid UTF-8 sequence

if save as Unicode, dmd ok! but  run  hello.exe and output is error.

how to use chinese string in d source



jmchxy 163.com
Apr 21 2005
next sibling parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
jmchxy 163.com schrieb am Thu, 21 Apr 2005 12:34:44 +0000 (UTC):
 help me!
 I'm a Chinese programmer, a C++ programmer  and a new member for D. 

this newsgroup is deprecated use digitalmars.D or digitalmars.D.learn Thomas
Apr 21 2005
prev sibling parent "Walter" <newshound digitalmars.com> writes:
<jmchxy 163.com> wrote in message news:d486l4$2vg4$1 digitaldaemon.com...
 bugs:

 /*
 hello.d
 */

 int main(char[][] args)
 {
 printf("!\n");
 return 0;
 }

 save as ascii or utf8:

 dmd output:

 hello.d(3): invalid UTF-8 sequence
 hello.d(3): invalid UTF-8 sequence
 hello.d(3): invalid UTF-8 sequence

 if save as Unicode, dmd ok! but  run  hello.exe and output is error.

 how to use chinese string in d source

Use writef, rather than printf. writef will write UTF-8 strings properly. printf is C's printf, which doesn't handle UTF-8.
May 22 2005