Home  >  Q&A  >  body text

c++ - codeblocks中文乱码问题

用codeblocks编译文件,某些文件能编译成功,并且中文不乱码,但是有一些项目虽然编译也成功,但是在窗口里面中文变成了乱码,求大牛指点解决方法!急,在线等

伊谢尔伦伊谢尔伦2764 days ago569

reply all(3)I'll reply

  • 黄舟

    黄舟2017-04-17 11:43:41

    You can try setting the encoding format. Garbled Chinese characters are usually caused by incorrect encoding format. Chinese characters are encoded in gbk. You can set it to utf-8 encoding and try

    reply
    0
  • 阿神

    阿神2017-04-17 11:43:41

    I have also been struggling with this problem. If I compile it correctly on cb, it will be garbled on vs. If I compile it correctly on vs, it will be garbled on CB. Even changing the format doesn't work. . . English is used directly afterwards

    reply
    0
  • 黄舟

    黄舟2017-04-17 11:43:41

    codeblocks is saved as local win code by default
    The default processing file of mingw-gcc is UTF-8. Add -finput-charset=charset
    to the gcc compilation option. charset is the encoding you use, such as -finput-charset=GBK
    This can be said to be a compiler problem and has nothing to do with codeblocks. . .
    As long as the encoding is unified, there will be no mistakes

    reply
    0
  • Cancelreply