[Mono-dev] Problem with PackagePart URI containing spaces

mhartmann mhartmann at vr-web.de
Mon Nov 23 06:53:32 EST 2009


Hi,

I'm trying to read packages that were created with System.IO.Packaging on a
Windows machine using .NET.

It seems that that there is a problem with PackageParts that contain spaces
in the specified package URI.

Using the following code produces different results on .NET / Mono:

string fileName = "Test.zip";
Uri uri = PackUriHelper.CreatePartUri(new Uri("/My Folder/Test.txt",
UriKind.Relative));
            
using (Package package = Package.Open(fileName, FileMode.Create))
{
    PackagePart part = package.CreatePart(uri,
System.Net.Mime.MediaTypeNames.Text.Plain);
    using (StreamWriter sw = new StreamWriter(part.GetStream()))
    {
        sw.WriteLine("Hello World");
    }
}

On Linux using Mono the ZIP file contains a folder "My Folder", but with
Windows and .NET the name of the folder is escaped ("My%20Folder").

Best regards
Martin
-- 
View this message in context: http://old.nabble.com/Problem-with-PackagePart-URI-containing-spaces-tp26476712p26476712.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list