Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gsr -f FILE appears to reading as latin1, not as expected utf8 #61

Open
GoogleCodeExporter opened this issue Aug 23, 2015 · 3 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1.  Download the attachment
2. gsr -S -f utf8.js

What is the expected output? What do you see instead?

The current output is a syntax error on some latin1 chars on line 32:

Uncaught exception in utf8.js:32: missing ; before statement
utf8.js:32:                   if(jQuery('#userlogin_label span').is(':visible') ) 
utf8.js:32: ^


using "-U" does not help


The expected output is 

$ iconv -f utf-8 -t latin1 < ~/utf8.js > /tmp/junk.js
nickg-macbook-2:gpsee nickg$ gsr -S -f /tmp/junk.js 

Uncaught exception in junk.js:2: jQuery is not defined
    in junk.js at 2 


There are "invisible characters" on line 32..  "cat -v -t" doesn't show it

 using a hex dump I found that its

0xC2 0xA0 which is UTF-8  converting into Unicode as "0xA0" which is a 
"non-breaking space." 
which is ignore by the js parser (it's plain ol whitespace).

This file also correctly parses in firefox 


Please use labels and text to provide additional information.


Original issue reported on code.google.com by nickgsup...@gmail.com on 9 Apr 2010 at 9:41

Attachments:

@GoogleCodeExporter
Copy link
Author

oh yeah, my environment,... this one is Mac OS 10.6.3

the only locale stuff is this:

$ export
...
declare -x LANG="en_US.UTF-8"
...


Original comment by nickgsup...@gmail.com on 9 Apr 2010 at 9:42

@GoogleCodeExporter
Copy link
Author

Spidermonkey does not [currently] support files encoded with UTF-8.

If we want GPSEE to read UTF-8 source code, we have to do the same as the 
brower:
buffer the script, convert to UTF-16 and execute, rather than our current scheme
which compiles the FILE * stream as it is read in.

Original comment by wes%page...@gtempaccount.com on 9 Apr 2010 at 9:59

@GoogleCodeExporter
Copy link
Author

ahh ok,  then perhaps just another blurb in the "-h"  help saying -f is for 
latin1 only is all that is needed.

I suspect this may be a (future) issue with require as well.

-nickg

Original comment by nickgsup...@gmail.com on 10 Apr 2010 at 10:39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant