Skip to content

Feature: Add ZIP encoding selection support for browsing archives with non-UTF-8 filenames#18529

Open
oxygen-dioxide wants to merge 4 commits into
files-community:mainfrom
oxygen-dioxide:zip-encoding-oc
Open

Feature: Add ZIP encoding selection support for browsing archives with non-UTF-8 filenames#18529
oxygen-dioxide wants to merge 4 commits into
files-community:mainfrom
oxygen-dioxide:zip-encoding-oc

Conversation

@oxygen-dioxide
Copy link
Copy Markdown
Contributor

Problem
When opening a ZIP archive whose filenames use an encoding other than the user's OS encoding, the filenames appear garbled

Solution
Added a ComboBox in the navigation toolbar that appears when browsing a ZIP archive with undetermined encoding, allowing the user to select the appropriate character encoding. When a custom encoding is selected, the app switches from SevenZipSharp to SharpZipLib to read filenames and file contents.

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Download this zip file: japanese-example.zip
  2. In Files, double click this file to open it
  3. Select "Japanese (Shift-JIS)" encoding

previous behaviour:
image

current behaviour:
image

@oxygen-dioxide
Copy link
Copy Markdown
Contributor Author

oxygen-dioxide commented May 30, 2026

Problem: users still can't double-click a file in the archive to open it because process.Start() doesn't support custom zip encoding. (However, this bug also occurs for 7z files, so I may create another PR to fix it.)

Spacing="4">

<!-- ZIP Encoding Selector -->
<ComboBox
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please send a screenshot of this UI. I'm not sure the toolbar is the correct placement for a ComboBox.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the other options in the dropdown?

Copy link
Copy Markdown
Contributor Author

@oxygen-dioxide oxygen-dioxide May 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same as in my PR #17045, which is all possible ANSI encoding in Windows.
image

https://github.com/oxygen-dioxide/Files/blob/48e97f20266720dbcc15ec07fd270f1e4bacef64/src/Files.App/Data/Items/EncodingItem.cs#L45-L76

public static EncodingItem[] Defaults = new string?[] {
   		null,//System Default
           "UTF-8",
   		
           //All possible Windows system encodings
           //reference: https://en.wikipedia.org/wiki/Windows_code_page
           //East Asian
           "shift_jis",       //Japanese
           "gb2312",          //Simplified Chinese
           "big5",            //Traditional Chinese
           "ks_c_5601-1987",  //Korean
           
           //Southeast Asian
           "Windows-1258",    //Vietnamese
           "Windows-874",     //Thai
           
           //Middle East
           "Windows-1256",    //Arabic
           "Windows-1255",    //Hebrew
           "Windows-1254",    //Turkish
           
           //European
           "Windows-1252",    //Western European
           "Windows-1250",    //Central European
           "Windows-1251",    //Cyrillic
           "Windows-1253",    //Greek
           "Windows-1257",    //Baltic
           
           "macintosh",
   	}
   		.Select(x => new EncodingItem(x))
   		.ToArray();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bottom right corner of the status bar might be a better location. Fyi @mdtauk

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

Successfully merging this pull request may close these issues.

Bug: File names for Japanese zips aren't shown correctly on Chinese language

2 participants