Projects > cpp > Issues > Refactor #1830

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

Using JS::CompileOptions::setUTF8(true) to compile script.

Refactor #1830 [Closed]
dumganhar 2013-03-13 10:09 . Updated about 10 years ago

Refers to the email Rolando sent:
<pre>
I noticed that
dumganhar commented out the line setting the UTF8 option for scripts. This has the following consequences:

  • it requires the file to either be UTF-16LE or ascii only
  • it assumes the build side is non-UTF8

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>

dumganhar 2013-03-13 10:10
  • Subject changed from Using JS::CompileOptions::setUTF8 to compile script. to Using JS::CompileOptions::setUTF8(true) to compile script.
dumganhar 2013-03-14 05:36
  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:96d5b299cc3726c46b3015a56d12c02a832ff4cd.

Atom PDF

Status:Closed
Start date:2013-03-13
Priority:Normal
Due date:
Assignee:dumganhar
% Done:

100%

Category:js
Target version:cocos2d-2.1rc0-x-2.1.2