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
GM should fail gracefully when encountering scripts with invalid encoding #1588
Comments
I agree that things should fail gracefully. But the linked script does not contain UTF-8.
That character between the single quotes is an If I load that script (with GM disabled, to see the source directly) then I see a question mark in a box there. If I manually set ISO-8859-1 character encoding (Firefox has guessed UTF-8 without anything from the headers) then I get an 'è'. http://www.fileformat.info/info/unicode/char/e8/index.htm I do still get the same errors from a script that's really delivered in UTF-8 w/out a charset in the headers:
In this case, interestingly enough, Firefox guesses ISO even though the content is UTF-8. |
Yeah, sorry, I was experimenting a bit, so I've now uploaded a new version and edited my post. The script now indeed contains valid ISO-8859-1. It's a bit weird though that for you Firefox guesses UTF-8 as content-type, while it (correctly, especially when following the RFC) guesses ISO-8859-1 for me. If I disable GM and open to the script, I see the è just fine. But even then, GM still throws the error. |
Interestingly, for me a script which contains valid UTF-8 and is served without charset (but with "Content-Type: text/javascript") works just fine (http://ventero.de/temp/encoding-utf8.user.js). Your example is sent with "Content-Type: text/html", so that GM doesn't try to install it anyway. |
Greasemonkey: 1.0beta5 Test scripts:
If I disable greasemonkey, and navigate to each as a page, then inspect View>Character Encoding, the first two both choose ISO-8859-1, and display incorrectly, the last displays correctly. In all cases, if I enable Greasemonkey and install the script, they work as the actual delivered content is UTF-8. This is as I believe it should be; it's easy for script authors to control the content of hosted files, and often harder for them to get the HTTP headers set correctly. Now: if I put ISO-8859 encoding in the file (for all six test cases see http://arantius.com/misc/gm-test/ ): Firefox makes the same guesses, which work for the first two cases (guess is right), but when I explicitly say (in headers) that the content is UTF-8, but the body contains ISO-8859, then Firefox fails to display correctly. In all file-contains-ISO cases, Greasemonkey dies during the install. This needs to be fixed. |
When opening a script file with invalid encoding (for example http://ventero.de/temp/encoding.user.js - which doesn't contain valid UTF-8), Greasemonkey throws two errors:
and
and doesn't display the install dialogue or the script's source.
It's probably a good idea to display a message explaining the problem.
The text was updated successfully, but these errors were encountered: