User forums > General (but related to Code::Blocks)

none english code in codeblocks, became unreadable code??

<< < (2/2)

zaazbb:
when i build my project, the CB show a message as "encode changed ..", and my file save as utf8 automatily.   now, build and run my gui, the control text are unreadable. 

thomas:
That is not surprising, you're using different code pages when editing/compiling and running the program, so your Chinese characters come out as rubbish.

If you insist on writing Chinese in a non-Unicode program (which is somewhat unwise), you need to tell the compiler that you want to do such a thing, the switch for that would be something like -finput-charset=window936 for gcc. If you don't tell the compiler anything, it assumes UTF-8 encoding.

Otherwise, leave everything as it is in Code::Blocks and write a proper Unicode program (including L"" strings and the correct #defines for your toolkit/os) and you will have no such problems.

zaazbb:

--- Quote from: thomas on December 19, 2011, 10:07:19 am ---That is not surprising, you're using different code pages when editing/compiling and running the program, so your Chinese characters come out as rubbish.

If you insist on writing Chinese in a non-Unicode program (which is somewhat unwise), you need to tell the compiler that you want to do such a thing, the switch for that would be something like -finput-charset=window936 for gcc. If you don't tell the compiler anything, it assumes UTF-8 encoding.

Otherwise, leave everything as it is in Code::Blocks and write a proper Unicode program (including L"" strings and the correct #defines for your toolkit/os) and you will have no such problems.

--- End quote ---

thank you very much!~~ ;D

Navigation

[0] Message Index

[*] Previous page

Go to full version