User forums > Using Code::Blocks

Is there a method to save the source files in UTF-8 format in C::B?

(1/2) > >>

00061205:
Is there a method to save the source files in UTF-8 format in C::B?
In windows version C:B,the source files will not save by UTF-8 format. Gcc will report error if there are some local characters (eg. á é í ó ú ñ Ñ É 中文) in the source files. If we convert the source files to UTF-8 format manually with other applications this problem will overcome.

Biplab:
Yes there is. Click-

1) Edit > File encoding > UTF-8.
2) Edit > File encoding > Save byte-order-mark (BOM)

The second option is necessary if you want to force every source files to be detected as UTF-8.

00061205:

--- Quote from: Biplab on June 15, 2008, 05:04:45 pm ---Yes there is. Click-

1) Edit > File encoding > UTF-8.
2) Edit > File encoding > Save byte-order-mark (BOM)

The second option is necessary if you want to force every source files to be detected as UTF-8.

--- End quote ---
Thanks.
It works when just enable  Edit > File encoding > UTF-8. When I complie with both enabled I get this error message:E:\CodeBlocks\CBProjects\hword\hword.cpp|1|error: stray '\239' in program|

Biplab:

--- Quote from: 00061205 on June 15, 2008, 05:17:31 pm ---Thanks.
It works when just enable  Edit > File encoding > UTF-8. When I complie with both enabled I get this error message:E:\CodeBlocks\CBProjects\hword\hword.cpp|1|error: stray '\239' in program|

--- End quote ---

Try adding -finput-charset=utf-8 to compiler options.

thomas:
Rather, add no option, and don't use that byte order mark. UTF-8 is gcc's default encoding.

Navigation

[0] Message Index

[#] Next page

Go to full version