After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 687095 - Wrong encoding of imported js file
Wrong encoding of imported js file
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
: 690716 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-10-29 10:28 UTC by Guillaume Desmottes
Modified: 2012-12-25 17:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
encoding.js (257 bytes, text/plain)
2012-10-29 10:28 UTC, Guillaume Desmottes
  Details
bug.js (35 bytes, text/plain)
2012-10-29 10:28 UTC, Guillaume Desmottes
  Details
Convert imported modules from UTF-8 to UTF-16 before executing (5.02 KB, patch)
2012-10-29 17:47 UTC, Giovanni Campagna
committed Details | Review

Description Guillaume Desmottes 2012-10-29 10:28:31 UTC
Created attachment 227512 [details]
encoding.js

First try to run encoding.js on its own:
  - gjs ./encoding.js
  - "15 °C" is properly displayed, all good

Now try running bug.js which will just import encoding.js
  - GJS_PATH=$(pwd) gjs ./bug.js
  - "15 °C" is displayed so the encoding of the string has been changed during the import.
Comment 1 Guillaume Desmottes 2012-10-29 10:28:47 UTC
Created attachment 227513 [details]
bug.js
Comment 2 Giovanni Campagna 2012-10-29 17:47:49 UTC
Created attachment 227569 [details] [review]
Convert imported modules from UTF-8 to UTF-16 before executing

If JS_CStringsAreUTF8 is false, the JSAPI assumes C strings are
ISO-8859-1. Unfortunately, we rely on that setting for byte arrays,
so just do the conversion ourselves, like we do in gjs_context_eval().
Comment 3 Jasper St. Pierre (not reading bugmail) 2012-10-29 18:00:28 UTC
Review of attachment 227569 [details] [review]:

Sure.
Comment 4 Guillaume Desmottes 2012-10-30 09:03:46 UTC
This patche fixes my bug, thanks a lot!
Comment 5 drago01 2012-11-02 11:04:05 UTC
Attachment 227569 [details] pushed as c614834 - Convert imported modules from UTF-8 to UTF-16 before executing
Comment 6 Giovanni Campagna 2012-12-25 17:47:12 UTC
*** Bug 690716 has been marked as a duplicate of this bug. ***