when my c++ code have chinese character, CodeBlock save file as UTF8 automatically,
so my chinese character now is unreadable code. how to change it??
when i change file encode to window936, gcc compiler meet errors.??
How can i use none english code in codeblocks???
I use chinese as "string" , donot meet such things.
Quote from: zaazbb on December 18, 2011, 04:42:33 AM
so my chinese character now is unreadable code. how to change it??
Why?
You save your file in UTF8, and you should read/open it in UTF8.
I think you had better use English! After all, it's a English IDE.
Quote from: zaazbb on December 18, 2011, 04:42:33 AM
when my c++ code have chinese character, CodeBlock save file as UTF8 automatically,
so my chinese character now is unreadable code. how to change it??
when i change file encode to window936, gcc compiler meet errors.??
How can i use none english code in codeblocks???
Where is the code unreadable ?
Should be readable in C::B, if it is opened as utf-8.
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.
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.
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.
thank you very much!~~ ;D