We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
Using JS::CompileOptions::setUTF8(true) to compile script.
Using JS::CompileOptions::setUTF8(true) to compile script.
Refactor #1830 [Closed]
Status: | Closed | |
---|---|---|
Start date: | 2013-03-13 | |
Priority: | Normal | |
Due date: | ||
Assignee: | ||
% Done: | 100% |
|
Category: | js | |
Target version: | cocos2d-2.1rc0-x-2.1.2 |
Refers to the email
Rolando sent:
dumganhar commented out the line setting the UTF8 option for scripts. This has the following consequences:<pre>
I noticed that
I think this should be an option left to the developer. The rationale behind is that script files passed to the VM need to be in the proper encoding and aligned with this option. If you remove that comment, then all javascript files to be loaded from jsbindings need to be either plain ascii or UTF-16LE.
If we set the option, then all files need to be either plain ascii or UTF-8.
Note: by plain ascii I mean chars with values lower than 0x7F.
If you don’t do this, chances are it might work ok, but there will be issues if the script does something like string.charCodeAt() or some other function that requires access to the string internally.
We could create a #define that can be changed by the developer, and I think that might be a good solution.
On a final note, I’m adding a few utility functions to convert to/from UTF-8/UTF-16LE to ScriptingCore, using libiconv, this is going to work only for iOS for now, but we can compile our version of libiconv for Android.
—
Rolando Abarca
</pre>