Problems with special characters in Corona Simulator

I have problems to display the correct characters in the simulator on one specific PC. On other PC’s and on devices these characters are displayed OK. The characters in question is the Norwegian/Danish ÆØÅ and also the copyright character ©. These characters are replaced by questionmark-in-diamond.

Can anybody help me out?

Corona SDK fully supports UTF-8 characters as long as your text editor does. If you’re text editor is not in UTF-8 mode, you will get symbols like that.

Rob

Right.  Make sure to save your Lua files with a “UTF-8” encoding without a BOM signature.

Thanks for your help. It seems like my source file was once saved with the wrong character coding (ANSI) and after that didn’t convert the special characters back when I changed coding to UTF-8 in the Save dialog. A little strange, they all showed up normally in Notepad afterwards but not in the Simulator.

Anyway, problem now solved :slight_smile:

Happy to help!

And a bit of warning about Windows “Notepad”.  While it does support encoding the file to UTF-8, it will always add a BOM signature to the file which will cause a Lua runtime error.  Unfortunately, Notepad does not given you the option to encode the file *without* a BOM signature.  You have to use a different editor if you want to add Unicode to your code.  Also, most Windows text/code editors default to ANSI and not UTF-8 (it’s a legacy thing).

Use Notepad ++

Just a note.

I use Notepad++ and use mainly asian chars (without BOM). Some characters may not show on Notepad++ (will just appear as a ‘box’), but the character will show properly on the device.

Corona SDK fully supports UTF-8 characters as long as your text editor does. If you’re text editor is not in UTF-8 mode, you will get symbols like that.

Rob

Right.  Make sure to save your Lua files with a “UTF-8” encoding without a BOM signature.

Thanks for your help. It seems like my source file was once saved with the wrong character coding (ANSI) and after that didn’t convert the special characters back when I changed coding to UTF-8 in the Save dialog. A little strange, they all showed up normally in Notepad afterwards but not in the Simulator.

Anyway, problem now solved :slight_smile:

Happy to help!

And a bit of warning about Windows “Notepad”.  While it does support encoding the file to UTF-8, it will always add a BOM signature to the file which will cause a Lua runtime error.  Unfortunately, Notepad does not given you the option to encode the file *without* a BOM signature.  You have to use a different editor if you want to add Unicode to your code.  Also, most Windows text/code editors default to ANSI and not UTF-8 (it’s a legacy thing).

Use Notepad ++

Just a note.

I use Notepad++ and use mainly asian chars (without BOM). Some characters may not show on Notepad++ (will just appear as a ‘box’), but the character will show properly on the device.