Skip to content

Loading…

the ‘Experimental features’ messed with jQuery-UI datepicker l10n #362

Closed
notxx opened this Issue · 12 comments

2 participants

@notxx

it should look like this
image
and now it's like this
image
i think the root is base64'ed js file is not decoded using utf-8 charset.

@gorhill

Is there a URL I can use to test for fixes?

@notxx

it looks like i've found the cure
change
data:application/x-javascript;base64,YWxlcnQoJ+a1i+ivlScp
into
data:application/x-javascript;charset=utf-8;base64,YWxlcnQoJ+a1i+ivlScp

then the javascript is decoded correctly.

check
http://jsfiddle.net/xf8ov1jj/
(sadly the jsfiddle editor is crushed by my code)

@gorhill

data:application/x-javascript;charset=utf-8;

I want to investigate further, I can't do this blindly. Some data is binary, sometimes it may be a charset. I may have to revive code I had, to extract charset.

@notxx
@gorhill

It's not only javascript being mirrored, it's not only text being mirrored. I used to use charset before in the data: URI, until I converted to an ArrayBuffer. I will just bring back that code, which read the charset from the HTTP headers, not hard-coded.

I just wanted the real life scenario you encountered to inspect the HTTP header etc. to verify that all the information I need is in there in.

@notxx
@gorhill

It's ok, your jsfiddle here works as a test case.

@gorhill

Ok looking into this now.

Unfortunately, the charset is not specified in the response headers when receiving the resource through XHR. That is a problem. I suspect that normally, the browser will use the charset of the page, if one for the resource is not specified. But it looks like the browser may not be doing this for when the resource is from a data: URI. I feel like there is a browser issue here given the inconsistency.

I can't hard-code for UTF-8, because it could very well happen the resource is actually in another charset. Anyway as said above, I can't also just blindly add charset=, given that the resource may be something else than text (image/png, font/woff, etc.)

@gorhill

I will go with some heuristic to figure whether charset=utf-8 can be slapped for when charset is not specified. Found some documentation which I will use as the rationale for now for the chosen solution:

5 . If the "getting an encoding" steps above return failure, then set encoding to null.

6 . If encoding is null, then set encoding to utf-8.

@gorhill gorhill added a commit that closed this issue
@gorhill gorhill this fixes #362 281dc70
@gorhill gorhill closed this in 281dc70
@gorhill

This page says "with no charset (default should be US-ASCII)". If true, using UTF-8 seems entirely acceptable given UTF-8 intersects completely with ASCII over the ASCII set.

@notxx
@AlexVallat AlexVallat pushed a commit to AlexVallat/uBlock that referenced this issue
@gorhill gorhill attempt at fixing #362 69d4a0a
@ahmadassaf ahmadassaf added a commit to ahmadassaf/uBlock that referenced this issue
@ahmadassaf ahmadassaf Merge branch 'master' of https://github.com/gorhill/uBlock
* 'master' of https://github.com/gorhill/uBlock: (66 commits)
  Update README.md
  Exception script tag filter makes no sense: reject such filters
  oops, fix to #756 needs this
  translation work from https://crowdin.com/project/ublock
  comment grammar
  this fixes #756
  this fixes #762
  this fixes #762
  this addresses #759 -- until fix is in EasyPrivacy
  translation work from https://crowdin.com/project/ublock
  code review of new script tag filtering code
  translation work from https://crowdin.com/project/ublock
  new cosmetic filter to foil specific inline script tags
  this addresses #275: test case send through email
  this fixes #640
  reverting #739: this broke normal install
  translation work from https://crowdin.com/project/ublock
  interim version for dev build
  re. #724: configurable xhr timeout
  attempt at fixing #362
  ...
06ce64f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.