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

Internationalized domainnames results in breaking up the domainname #48

Open
emilhem opened this issue Aug 6, 2015 · 2 comments
Open

Comments

@emilhem
Copy link
Contributor

emilhem commented Aug 6, 2015

When going to domains with internationalized domainnames such as http://www.vårdverktyget.se/ it causes unblocker to redirect to http://www.v/årdverktyget.se/ instead making unblocker trying to connect to the domain www.v instead of www.xn--vrdverktyget-tcb.se.

I might look into this at a later time unless you get to it first.

Look into Punycode: https://en.wikipedia.org/wiki/Punycode

Possible module: https://www.npmjs.com/package/punycode

@nfriedly
Copy link
Owner

nfriedly commented Aug 6, 2015

Hum. I'm not sure how that's happening, but yea, please take a look. require('url').parse('http://www.vårdverktyget.se/') correctly de-punycodes it, which is mostly what I use internally.. but there's probably something somewhere that doesn't handle it correctly.

@emilhem
Copy link
Contributor Author

emilhem commented Aug 7, 2015

The browsers send characters like åäö URI encoded.

I tried setting

clientRequest.url = decodeURIComponent(clientRequest.url)

Between line 114 and 116 in unblocker.js and it somewhat works but creates different errors.

Putting in http://www.vårdverktyget.se/this/path/?why=dåes&thisz=nottåäö#work=måäö results in redirection to http://www.xn--vrdverktyget-tcb.se/this/path/?why=d%E5es&thisz=nott%E5%E4%F6#work=m%C3%A5%C3%A4%C3%B6 and an error URIError: URI malformed

Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent

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

No branches or pull requests

2 participants