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
Show script source messes up character encoding #1940
Comments
The URL of a web page vs. the local file URL. However, this did not help: https://github.com/greasemonkey/greasemonkey/blob/master/modules/remoteScript.js#L432 var tab = aTabBrowser.loadOneTab(
ioService.newFileURI(this._scriptFile).spec,
{'inBackground': false}); var tab = aTabBrowser.loadOneTab(
ioService.newFileURI(this._scriptFile).spec,
{'inBackground': false, 'charset': 'UTF-8'}); (all scripts must be encoded with UTF-8) But this works: about:config from: intl.charset.detector = "" to: intl.charset.detector = "universal_charset_detector" http://www-archive.mozilla.org/projects/intl/chardet.html You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008 |
So:
When the file comes from the server, it gets a header saying that it's UTF-8. When we navigate the browser to the stored file, it has no such header. IOW right click and save the link given in the original description, disable GM (if necessary) and open it in Firefox. You'll get the same thing. In this case at least, Firefox guesses wrong about the encoding. It would be nice to be able to force it to use UTF-8, because in other places, that is already the only encoding that Greasemonkey supports for scripts. @janekptacijarabaci obviously tried to do that but it didn't work? |
Yes, it does not work, and I don't know why. |
Ad greasemonkey#1940 The suggestion (for example).
Ad greasemonkey#1940 The suggestion (for example).
I've looked through the code that's executed when
The try/catch around that part suggests that this might be expected behavior, but I couldn't find any tests for this, and
Edit: Not sure why I thought unwrapping helped, as the interface doesn't even contain |
Reported upstream as https://bugzilla.mozilla.org/show_bug.cgi?id=1046335 |
* Similar to @janekptacijarabaci fix in greasemonkey/greasemonkey#1940 * Fix compliance with STYLEGUIDE.md and usage of pre-initialized identifiers * Currently **do not** propagate BOM with meta routine or user.js source with and without installation count increment * BOM currently shows up in Ace as a exclamation triangle with "This character may get silently deleted by one or more browsers" **NOTE**: Many thanks to the report by @cvzi and applies to OpenUserJS#200 and partially outlined in OpenUserJS#198.
GM 2.0b2, Firefox 30 on Ubuntu.
https://greasyfork.org/scripts/2665-贴吧模组屏蔽/code.user.js with Greasemonkey disabled:
With Greasemonkey enabled, after pressing Show script source:
The text was updated successfully, but these errors were encountered: