Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 381986

Summary: Safari / IE not representing DBCS links properly
Product: [ECD] Orion Reporter: Ken Walker <ken_walker>
Component: ClientAssignee: Project Inbox <orion.client-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse, harendra, mamacdon, takajo, takepon
Version: 0.4   
Target Milestone: 4.0 M2   
Hardware: All   
OS: All   
Whiteboard: GVT

Description Ken Walker CLA 2012-06-07 08:59:47 EDT
When a folder and/or filename contain DBCS characters the link that Safari shows is encoded incorrectly and will not work.  These same links work find in Chrome and Firefox.

I got Libing to test IE and it seems to have similar problems as Safari.
Comment 1 Ken Walker CLA 2012-06-19 17:11:14 EDT
What's interesting is that I found you can navigate using the Console and open something in an editor in Safari so it's the links being interpreted incorrectly it seems.
Comment 2 Takehiko Ishii CLA 2013-04-29 05:27:27 EDT
same behaviors in Safari 6.0.4 on Mac OS X 10.8.3 as of 29th April 2013. URL of DBCS folder is encoded incorrectly.
Comment 3 Ken Walker CLA 2013-04-29 15:34:15 EDT
We have tried to address this however have not found a workaround as of yet.  It is the only browser that exhibits the behaviour like this at the moment.  Will look at it again.
Comment 4 Mark Macdonald CLA 2013-04-29 16:15:18 EDT
Here's the URLs that are actually being requested when you try to open a folder in a new tab (in this case the folder name is "你好"):

> Safari -  http://localhost:8080/navigate/table.html#/file/mamacdon/%26%2320320%3B%26%2322909%3B/?depth=1 (bad)

> Firefox - http://localhost:8080/file/mamacdon/%E4%BD%A0%E5%A5%BD/?depth=1  (ok)

Safari seems to barf out a fragment with the DBCS folder name encoded as HTML entities (&#20320;&#22909;) which are then URLencoded. Other browsers (correctly) use the UTF-8 encoding of the name, and URLencode it byte-by-byte.

If we can't trust the browser to encode the fragment properly, we'll have to encode it manually before setting the .href on our links.
Comment 5 Mark Macdonald CLA 2013-04-29 16:21:57 EDT
(In reply to comment #4)
> If we can't trust the browser to encode the fragment properly, we'll have to
> encode it manually before setting the .href on our links.

This is tricky to fix in general, since there's many places where we create links using JavaScript. But the navigator can be fixed by changing only 2 places:

extensionCommands line 310:
> var uriTemplate = new URITemplate(this.info.uriTemplate);
> return window.decodeURIComponent(uriTemplate.expand(variableExpansions));

^ TBH I'm not sure why it's doing the deocdeURIComponent there at all.

navigatorRenderer line 83:
> link.href = folderPageURL + "#" + item.ChildrenLocation; //$NON-NLS-0$

I think if we use the result of URITemplate.expand() without mucking around with it, the problem will go away.
Comment 6 Anthony Hunter CLA 2013-05-27 16:27:57 EDT
(In reply to comment #0)
> I got Libing to test IE and it seems to have similar problems as Safari.

I am not having any problems with a folder and/or filename containing DBCS characters on IE 10.0.9200.16576 on Windows 7.
Comment 7 Mark Macdonald CLA 2013-05-29 17:17:20 EDT
FWIW, here is the proposed change I talked about in Comment 5:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?h=safari_dbcs
Comment 8 Ken Walker CLA 2013-10-24 14:29:47 EDT
This appears fixed with the URL work that was done.