Thread overview | |||||
---|---|---|---|---|---|
|
April 21, 2005 dmd bugs on string | ||||
---|---|---|---|---|
| ||||
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 |
April 21, 2005 Re: dmd bugs on string | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmchxy |
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.
<snip>
this newsgroup is deprecated use
digitalmars.D or digitalmars.D.learn
Thomas
|
May 22, 2005 Re: dmd bugs on string | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmchxy | <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. |
Copyright © 1999-2021 by the D Language Foundation