Bug 199494 - [WPE][GTK] Wrong default encoding when browsing a local directory
Summary: [WPE][GTK] Wrong default encoding when browsing a local directory
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-04 05:43 PDT by Ting-Wei Lan
Modified: 2019-07-12 08:23 PDT (History)
2 users (show)

See Also:


Attachments
Screenshot of opening a local directory (50.63 KB, image/png)
2019-07-04 05:43 PDT, Ting-Wei Lan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ting-Wei Lan 2019-07-04 05:43:22 PDT
Created attachment 373460 [details]
Screenshot of opening a local directory

It seems that WebKitGTK always chooses the text encoding wrongly when browsing a local directory. It is very easy to reproduce. Just type 'file:///' in the address bar, and you will find bad characters appear in the page. Instead of asking users to click 'override text encoding' every time they want to browse local directories or find local HTML files, can WebKitGTK simply default to UTF-8 encoding when a local directory is opened?
Comment 1 Michael Catanzaro 2019-07-12 08:23:27 PDT
Hm, it's tricky.

For the directory view, we had better assume UTF-8 indeed. Obviously assuming Latin-1 is wrong. I have no clue where we would have to dive into the code to fix that.

But for web content, the default has to be ISO 8859-1 (Latin-1) for web compatibility.

Then what about e.g. text files accessed via file://? We use Latin-1 for these too, and it's always wrong. Needs some thought and investigation as to what Chrome does when there are no HTTP headers to indicate encoding and where the content is not an HTML document. (Firefox tries to guess the encoding, but that's risky. Not sure we want to try that.)