Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Possible character encoding issues with Chrome RDP #318

Closed
clarkbw opened this issue Jul 12, 2016 · 2 comments
Closed

Possible character encoding issues with Chrome RDP #318

clarkbw opened this issue Jul 12, 2016 · 2 comments
Labels

Comments

@clarkbw
Copy link
Contributor

clarkbw commented Jul 12, 2016

Chrome seems to be returning the decoded string for the URL. This may be creating the next problem where Chrome cannot create the web socket connection because the URL is undefined. Firefox loads the debugger page just fine.

api.js:1020 Uncaught (in promise) DOMException: Failed to construct 'WebSocket': The URL 'undefined' is invalid.(…)
WebInspector.WebSocketConnection @ api.js:1020
WebInspector.WebSocketConnection.Create @ api.js:1033
resolve @ index.js:32
connect @ index.js:30
connectTab @ chrome.js:52
(anonymous function) @ index.js:37callNext @ task.js:30
Promise.resolve.then.value @ task.js:36

Here's a test website: http://xn--80ahjdhy.xn--p1ai/

Screenshot of the difference at the tabs page:
screen shot 2016-07-12 at 1 21 45 pm

@jasonLaster
Copy link
Contributor

Nice find @clarkbw

@jasonLaster jasonLaster modified the milestone: Sprint 3 Jul 29, 2016
@clarkbw clarkbw removed this from the Sprint 3 milestone Aug 9, 2016
@clarkbw
Copy link
Contributor Author

clarkbw commented Aug 11, 2016

I'm not seeing this error anymore, the websocket connection works, so I think we can close this even though the display is still incorrect.

Here's what I found about the issue.

Chrome is returning an IDN in Punycode though I'm not sure why because they display it correctly in their URL bar. IDN in Google Chrome explains the Chrome thinking around punycode but not for what we are seeing.

To fix this I believe what we would need to use a library like https://github.com/bestiejs/punycode.js to decode the URL for display. (this module was previously included in node.js, now being removed for an internal solution)

const punycode = require('punycode');
punycode.decode("http://xn--80ahjdhy.xn--p1ai/") // -> http://дизайн.рф/

Because the WebSocket connection is being made and the debugger works I don't think we need to fix this right away.

I believe the official solution is the URL.domainToUnicode method. However it seems fairly unclear what the status of that API is going forward, it is not implemented in Firefox or Chrome. Servo has implemented the WHATWG method of URL.domainToUnicode servo/servo#11629 and servo/servo#11632 yet the WHATWG actually removed the API here: whatwg/url#63 in favor of this different API: whatwg/url#64

@clarkbw clarkbw closed this as completed Aug 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants