Thursday, April 14, 2011

Xcode: Converting to execution character set: Illegal byte sequence

If you are working on multiple platforms you may run into Unicode trouble if you do not save your files correctly.
This test string worked just fine in VS2010:

wchar_t* wstr = L"ÅäöJerry";

But gave the following compiler error in Xcode:

This error happens because the file was saved in a non-Xcode compatible unicode format.
If you intend to use Unicode characters in your source file, make sure the file is in a format Xcode supports. I resaved the file in VS2010 as UTF8, which solved the problem.