Advertisement

Using characters such as in AS

Started by January 11, 2010 06:13 PM
1 comment, last by andrew1b 15 years, 1 month ago
I'm having trouble trying to send characters such as ãéíàáç, etc. from my script code to the application although I have turned on the UTF-8 encoding. As far as I know, these characters (used in portuguese, spanish and french) are included in the UTF-8 (I might be wrong). The AS engine returns a warning saying thar I'm using invalid unicode sequences, and my program prints messed up strings. Any hint?
r = m_pASEngine->SetEngineProperty(asEP_SCRIPT_SCANNER, 1);
r = m_pASEngine->SetEngineProperty(asEP_STRING_ENCODING, 0);
...
You may want to pick up the latest WIP of AngelScript. I fixed a bug regarding this in revision 534.

If asEP_SCRIPT_SCANNER is set to 1 (default) the script code is assumed to be encoded in UTF-8. If it is not, and the string constants contain ANSI characters above 127 then you will get this error.

Make sure you save the scripts in UTF-8 format. Text editors that support this (including Notepad.exe) usually includes the BOM character at the start of the file. For UTF-8 this is the three byte sequence, 0xEF, 0xBB, 0xBF.

If you do not want to use unicode, then set the asEP_SCRIPT_SCANNER to 0, in which case the scripts will be compiled 'as-is' without any attempts to interpret the bytes in the string constants. You'll need the bug fix mentioned above if you do this.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Thanks, I downloaded the last version and it now works fine with default ASCII code.
PS: it wasn't working with even with unicode because I forgot to change the file format do unicode.
...

This topic is closed to new replies.

Advertisement