www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

D - dmd bugs on string

↑ ↓ ← 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
→ 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
→ "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