Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTF-8 vital error for chinese character which to be printed in console #17927

Open
dlangBugzillaToGithub opened this issue Nov 11, 2019 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

ll reported this on 2019-11-11T16:14:04Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=20384

Description

import std.stdio;
import core.stdc.stdio;
import core.stdc.stdlib;
 


void main()
{
    system("chcp 65001");// change code page to utf-8
    system("cls");       //clear the console
    writeln("你好啊世界");//OK
    //string str="123456";  // if str is ascii, the correct result will be get
    string str="你好啊世界"c;
                  //if str is chinese characters, the wrong result will be get
    char[] chs=str.dup;
   for(int i=0;i<chs.length;i++)
   {
        writeln(chs[i]);//both number and content of chinese are wrong
   }
	system("pause");//pause

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant