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

JS: Uncaught URIError: URI malformed with Chrome/IE11 and ISO 8859-1 Encoding #8413

Closed
stastka opened this Issue Jul 23, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@stastka

stastka commented Jul 23, 2015

If Website has ISO 8859-1 encoding, you have Uncaught URIError Javascript error with Chrome (and IE) when URL have some special character

Samples with French character:
URL: /Les-droits-r%E9els
decode: /Les droits réels

or with German Umlaut

/Hasenb%F6hler-Franz
decode: Hasenböhler-Franz

Detailed Error:
Uncaught URIError: URI malformedD @ piwik.js:30(anonymous function) @ piwik.js:51(anonymous function) @ piwik.js:52

I used latest Piwik, 2.14.x

@mattab

This comment has been minimized.

Show comment
Hide comment
@mattab

mattab Jul 28, 2015

Member

Hi @stastka
Thanks for the report.

Let's try to reproduce and then:

  • add a test showing the bug in tests/javascript/
  • fix the issue
Member

mattab commented Jul 28, 2015

Hi @stastka
Thanks for the report.

Let's try to reproduce and then:

  • add a test showing the bug in tests/javascript/
  • fix the issue

@mattab mattab added this to the 2.15.0 milestone Jul 28, 2015

@stastka

This comment has been minimized.

Show comment
Hide comment
@stastka

stastka Jul 28, 2015

Hi @mattab

I create a small testpage to reproduce. The site contains links with french and german characters with ISO 8859-1 encoding. :

http://stastka.ch/piwiktest/

stastka commented Jul 28, 2015

Hi @mattab

I create a small testpage to reproduce. The site contains links with french and german characters with ISO 8859-1 encoding. :

http://stastka.ch/piwiktest/

@meyway

This comment has been minimized.

Show comment
Hide comment
@meyway

meyway Jul 30, 2015

Line 2140 of the current piwik.js:
locationHrefAlias = decodeWrapper(locationArray[1])

"decodeWrapper" is "window.decodeURIComponent" and "decodeURIComponent" expects UTF-8.

Since "locationArray[1]" holds "window.location.href" and since that contains the ISO-8859-... - characters, current piwik (IMHO) is not fully compatible with websites that encode Links in ISO-8859-...

Is the use of "unescape" instead of / before using "decodeURIComponent" a solution to the problem?

meyway commented Jul 30, 2015

Line 2140 of the current piwik.js:
locationHrefAlias = decodeWrapper(locationArray[1])

"decodeWrapper" is "window.decodeURIComponent" and "decodeURIComponent" expects UTF-8.

Since "locationArray[1]" holds "window.location.href" and since that contains the ISO-8859-... - characters, current piwik (IMHO) is not fully compatible with websites that encode Links in ISO-8859-...

Is the use of "unescape" instead of / before using "decodeURIComponent" a solution to the problem?

@stastka

This comment has been minimized.

Show comment
Hide comment
@stastka

stastka Aug 3, 2015

Seems to resolve the issue possible.
I would test a patch on my system

stastka commented Aug 3, 2015

Seems to resolve the issue possible.
I would test a patch on my system

@tsteur tsteur self-assigned this Aug 7, 2015

@tsteur tsteur added the Bug label Aug 7, 2015

tsteur added a commit that referenced this issue Aug 7, 2015

@stastka

This comment has been minimized.

Show comment
Hide comment
@stastka

stastka Aug 17, 2015

@tsteur @mattab
I testet the patch e8bde68 and i have no error. The visitor log on Piwik show the visiting Test-Page. The Patch resolve the issue.

stastka commented Aug 17, 2015

@tsteur @mattab
I testet the patch e8bde68 and i have no error. The visitor log on Piwik show the visiting Test-Page. The Patch resolve the issue.

@tsteur tsteur closed this in #8510 Aug 17, 2015

@tsteur

This comment has been minimized.

Show comment
Hide comment
@tsteur

tsteur Aug 17, 2015

Member

Thx for the feedback!

Member

tsteur commented Aug 17, 2015

Thx for the feedback!

@mattab mattab changed the title from Piwik, 2.14.x: Javascript Error: Uncaught URIError: URI malformed with Chrome/IE11 and ISO 8859-1 Encoding to JS: Uncaught URIError: URI malformed with Chrome/IE11 and ISO 8859-1 Encoding Oct 13, 2015

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