Bug 184660 - [GTK] Can't load local files with accented characters
Summary: [GTK] Can't load local files with accented characters
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Local Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-16 12:31 PDT by Sebastien
Modified: 2019-01-12 10:02 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastien 2018-04-16 12:31:15 PDT
I tried to load this HTML page:

```html
<html>
<head>
  <meta charset=“utf-8”>
</head>
<body>
<img src="file:///home/AmarOk/T%C3%A9l/t7d4.jpg"><!-- NOT OK But file exists (works on firefox)-->
<img src="https://enconn.fr/T%C3%A9l/t7d4.jpg"><!-- OK -->
<img src="file:///home/AmarOk/Downloads/1.png"><!-- OK and file exists-->
</body>
</html>
```

And tried to load it via webkit_web_view_load_html or webkit_web_view_load_uri.

# Expected result

3 images should be shown

# Actual result

The first one with a 'é' in the path fails to load ([Error] Not allowed to load local resource: file:///home/AmarOk/T%C3%A9l/t7d4.jpg (test.html, line 8))

Didn't try on another OS
Comment 1 Alexey Proskuryakov 2018-04-16 21:24:36 PDT
This happens because of a mismatch between decomposed and precomposed Unicode forms, and a file system that fails to respect their equivalency. Arguably not fixable from WebKit in the general case.
Comment 2 Sebastien 2018-04-26 12:47:52 PDT
It works on other web engine so why not for WebKit?
Comment 3 Chris Dumez 2018-05-02 13:10:40 PDT
(In reply to Sebastien from comment #2)
> It works on other web engine so why not for WebKit?

Adding some WebKit-GTK developers in CC since this bug was reported on Linux and I cannot reproduce it on MacOS.
Comment 4 Chris Dumez 2018-05-02 13:12:20 PDT
(In reply to Chris Dumez from comment #3)
> (In reply to Sebastien from comment #2)
> > It works on other web engine so why not for WebKit?
> 
> Adding some WebKit-GTK developers in CC since this bug was reported on Linux
> and I cannot reproduce it on MacOS.

URL::fileSystemPath() for example is platform-specific and may be related to the issue here.
Comment 5 Michael Catanzaro 2018-05-02 16:10:51 PDT
Probably the same as bug #184444?
Comment 6 Alexey Proskuryakov 2018-05-03 09:20:27 PDT
> URL::fileSystemPath() for example is platform-specific and may be related to the issue here.

Ah, good point. For files specifically, file system path gets normalized on Darwin. I was thinking more about the same issue in application to HTTP.
Comment 7 Sebastien 2018-12-29 13:59:57 PST
(In reply to Michael Catanzaro from comment #5)
> Probably the same as bug #184444?

I think it's a similar bug indeed :)

I didn't have the time to dig this bug for now. And the only workaround I can do for now is to encode and inject into the page all resources but I really don't want to do that  :)
Comment 8 Jenyay 2019-01-12 10:02:39 PST
Because of this bug, browsers on the WebKit2 engine (Epiphany for example) do not display images in local HTML files if the path to this file contains non-Latin characters. Also in these files JavaScript scripts do not work.