Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: Grygoriy on June 04, 2007, 09:53:29 pm
-
Hi
I'm using CB, and I need some help.
My source files' encoding is UTF-8.
CB is using UTF-8 without BOM, but VS 2005 supports UTF-8 with BOM only. So if I want to build my project under Windows using VS 2005, I got some trash symbols insted of russian ones. I think that VS uses BOM to differ UTF-8 source files' encoding from Ansi one. And when it begins compilation, it compiles files, assuming that encoding is ansi.. And i have some strange symbols as an output )
So can you suggest some elegant solution for this problem?
-
Edit->File encoding->Save byte-order-mark (BOM)
:D
-
You see, I want to store sources in UTF-8 without BOM, so maybe some scripting will help me.. I will attempt to add BOM during compilation, and then to remove it back..
But it's a little bit ugly solution ))
-
You see, I want to store sources in UTF-8 without BOM, ...
Dare I ask why? If MSVC seems to expect it, why not use it?
-
It seems to me that UTF-8 without BOM just more universal, and BOM is not supported by some editors.
Am I wrong?
-
No, you're not wrong.
If you truly need for these source files to be compatible with editors that don't read and write a BOM, or compilers that can't cope, then the correct thing to do would be to avoid using non-standard characters in the source files, and use translation tools such as gettext to internationalize your program.
This is only really necessary for popular, internationalized projects which are designed to be portable between compilers, however, and I get the impression that yours is not. This is a good time to apply the YAGNI (http://c2.com/xp/YouArentGonnaNeedIt.html) principle -- don't try to plan for every eventuality.
Cheers,
John E. / TDM
-
Thanks )