Bug 37465 - App fails to unzip a file when device is in Arabic
Summary: App fails to unzip a file when device is in Arabic
Status: RESOLVED DUPLICATE of bug 54361
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 9.4 (iOS 9.2)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2016-01-07 02:14 UTC by Cody Beyer (MSFT)
Modified: 2017-04-01 02:01 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Cody Beyer (MSFT) 2016-01-07 02:14:59 UTC
### Description

When an iOS device/simulator is set to Arabic, the zip operation fails with the below error

### Error


### Sample


### Steps to Reproduce

1. Download sample
2. Open is XS
3. Set iOS simulator or device to Arabic
4. Deploy app

### Expected Results

App runs (this can be seen with device set to English 

### Actual Results

App crashes

### Versions

=== Xamarin Studio ===

Version 5.10.2 (build 49)
Installation UUID: 93ea852c-e632-46b7-9e0d-3856a02bc61e
	Mono 4.2.2 (explicit/7b87787)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402020010

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.2 (9548)
Build 7C68

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 78c6cd3
Branch: master
Build date: 2015-12-17 18:29:42-0500

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 510020049
Git revision: deed4cd240ff3611c8742bbc62296e207f46173d
Build date: 2015-12-17 11:13:36-05
Xamarin addins: 8bd975e7b465f6fe812b64d736f3b7e8c1a79a3e
Build lane: monodevelop-lion-cycle6-c6sr1

=== Operating System ===

Mac OS X 10.11.2
Darwin Codys-Mac.local 15.2.0 Darwin Kernel Version 15.2.0
    Fri Nov 13 19:56:56 PST 2015
    root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-01-07 03:12:49 UTC
## Regression status: not a regression 

BAD: Xamarin.iOS (78c6cd3) + Mono 4.2.2 (explicit/7b87787)
BAD: Xamarin.iOS (1f068b4) + Mono 4.0.5 (detached/1d8d582)

It seem that the codepage 720 text encoding has to date not yet been implemented in Mono. I have accordingly filed a new enhancement request to more precisely pinpoint that issue, and I am marking this bug as a duplicate.

*** This bug has been marked as a duplicate of bug 37467 ***
Comment 2 Brendan Zagaeski (Xamarin Team, assistant) 2016-01-07 04:28:29 UTC
There is an additional complication with this bug that might be interesting to mention: the .NET implementation of `ZipArchive.Create()` does not call the problematic `System.Text.Encoding.GetEncoding()` method at all, even when the current culture is set to Arabic. So it's possible that the original test case from comment 0 could stop showing symptoms even before Bug 37467 is addressed (if Mono imports the .NET implementation of ZipArchive sooner than it adds support for the codepage 720 text encoding).

For example, the following lines will fail with the Mono implementation of System.IO.Compression. But you can run them successfully on desktop Mono if you switch the System.IO.Compression reference to use the .NET CoreFX implementation [1].

> var zipPath = "zipCrash.zip";
> FileStream stream = File.Open(zipPath, FileMode.Open, FileAccess.Read);
> Thread.CurrentThread.CurrentCulture = new CultureInfo("ar-AE");
> ZipArchive zipArchive = new ZipArchive(stream, ZipArchiveMode.Read);
> foreach (var entry in zipArchive.Entries) {
>     Console.WriteLine(entry);
> }

[1] Specifically, I added a reference to `lib/netcore50/System.IO.Compression.dll` from the .NET CoreFX implementation NuGet package: https://www.nuget.org/packages/System.IO.Compression.

This same approach also works for the simple iOS test case from Comment 0, but I imagine it might cause build or runtime errors in a more complicated sample (because the CoreFX assembly was not built against the "Xamarin.iOS profile" [2]).

[2] https://developer.xamarin.com/guides/ios/under_the_hood/assemblies/
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2017-04-01 02:01:03 UTC
> if Mono imports the .NET implementation of ZipArchive sooner than it
> adds support for the codepage 720 text encoding

As of the current development branch named "2017-02", Mono has imported the .NET Core implementation of ZipArchive.  I will accordingly adjust this bug for bookkeeping to be a duplicate of a corresponding bug I just filed that records the verification status of that implementation change.

*** This bug has been marked as a duplicate of bug 54361 ***