Incorrect path for GhostScriptViewer


Using the sample of GhostScriptViewer i've noticed that there are some paths that make GhostScriptViewer throw a FormatException (because it's trying to cast a string as a page number, whereas the page number is the folllowing message : Unrecoverable erro : stackunderflow[...]

It' happen when using a path like :
C:\échanges\COMMDIS\PROD\Affaires\CPEN\CPEN140002 - EDF CIPN - PSPR\10 Suivi\40 Ecarts contract\Développements .NET...

Yes I know, a lot of unexpected caracter...


flipnode wrote Oct 5, 2015 at 2:39 PM

I do this before passing file path.
                    // just incase the fileName contains any diacritics
                    filePath = System.Text.Encoding.Default.GetString(System.Text.Encoding.UTF8.GetBytes(filePath));

wrote Dec 22, 2016 at 11:12 AM

Crayjin wrote Dec 22, 2016 at 11:21 AM

flipnode's code makes the Ghostscript.NET viewer working for me, if I replace the method StringHelper.ToUtf8String(string value) with it.
        public static string ToUtf8String(string value)
            return System.Text.Encoding.Default.GetString(System.Text.Encoding.UTF8.GetBytes(value));
Then I can open a pdf file with the path "C:\Müller\Umlaute.pdf", although I don't know if it breaks anything else.