This has to do with comparing the Javascript 1.8.5 interpreter with the
current version (built off of
https://github.com/mozilla/gecko-dev/tree/GECKO3601_2015030504_RELBRANCH)
The file 'utf8file.txt' is here
http://cornwarning.com/xfer/utf8file.txt
I've attached my test script -- if this listserve strips attachments,
it's here:
http://www.cornwarning.com/xfer/test.js
The problem I'm running into is a mismatch between the 'native' string
type and UTF8 files. This has to do with custom file reader JSNative
functions that I won't go into here, but the test script illustrates the
problem:
In the old (1.8.5) version, the strings are listed to have a length of
21, and in the new version, they've got a length of 17. I assume that
this has something to do with the changes mentioned here:
https://blog.mozilla.org/javascript/2014/07/21/slimmer-and-faster-javascript-strings-in-firefox/
The problem I have is reconciling the new behavior with our own code
that expects the old behavior. We have a custom function that reads
lines from a file and creates JS::String objects from each line. Using
the 1.8.5 JS library, the resulting strings are equal when tested in
Javascript. With the current version they are not equal.
There's another minor issue: In 1.8.5 read(<filename>, "binary") returns
a string, and the current version returns an Uint8Array. Don't think
most people would run into that script-breaking change, but it rather
baffled me.
Here is the output of my script, and the rendering of UTF8 text might
not survive e-mailing:
js185 test.js
185
"Láttam hörcsögöt." length=21
"Láttam hörcsögöt." length=21
equal=true
Y values
4c c3 a1 74 74 61 6d 20
68 c3 b6 72 63 73 c3 b6
67 c3 b6 74 2e
Y Binary length=21
Y binary values
Type of ybin string
Láttam hörcsögöt.
4c c3 a1 74 74 61 6d 20
68 c3 b6 72 63 73 c3 b6
67 c3 b6 74 2e
[kwilliams@onderon ~]$ js36 test.js
185
"Láttam hörcsögöt." length=17
"Láttam hörcsögöt." length=17
equal=true
Y values
4c e1 74 74 61 6d 20 68
f6 72 63 73 f6 67 f6 74
2e
Y Binary length=21
Y binary values
Type of ybin object
[object Uint8Array]
4c c3 a1 74 74 61 6d 20
68 c3 b6 72 63 73 c3 b6
67 c3 b6 74 2e
--
*Kent Williams*| C++ Developer
*CourseLeaf from Leepfrog Technologies *
/“The Process of Academic Change”
/
319-337-3877 |
courseleaf.com <
http://www.courseleaf.com/>
/This message contains confidential information and is intended only for
the individual named. If you are not the intended recipient of this
transmission or a person responsible for delivering it to the intended
recipient, any disclosure, copying, distribution, or other use of any of
the information in this transmission is strictly prohibited. Please
notify the sender immediately by e-mail if you have received this e-mail
by mistake and delete this e-mail from your system./