Bug 692270

Summary: Improve ghostscripts stdin/stdout handling w.r.t unicode
Product: Ghostscript Reporter: Robin Watts <robin.watts>
Component: GeneralAssignee: Default assignee <ghostpdl-bugs>
Status: RESOLVED FIXED    
Severity: enhancement CC: sags5495
Priority: P4 Keywords: bountiable
Version: master   
Hardware: PC   
OS: Windows XP   
Customer: Word Size: ---
Attachments: 0001-Add-Sags-unicode-patch-for-gswin32c-stdin-out.patch

Description Robin Watts 2011-06-09 17:01:03 UTC
gswin32c.exe now assumes that all input from stdin has been UTF8 encoded, and similarly writes all output UTF8 encoded. Characters that come in with top bits set will therefore confuse things.

Ideally we should process stdin so that we cope with unicode input, encoding as we go, and stdout so we convert utf8 back to unicode. In the case of file redirection, we want the files to come in exactly as they are though, so the unicode->utf8 munging should only effect things when the input is a terminal.
Comment 1 Robin Watts 2011-06-09 18:10:57 UTC
Created attachment 7584 [details]
0001-Add-Sags-unicode-patch-for-gswin32c-stdin-out.patch

Patch provided by Sags.
Comment 2 Robin Watts 2011-06-09 20:11:08 UTC
Committed as:

commit ce51b64c335d6c995c003497988d0327c64985cb
Author: Robin Watts <Robin.Watts@artifex.com>
Date:   Thu Jun 9 16:07:15 2011 +0100

    Add Sags unicode patch for gswin32c stdin/out.

    Patch from Sags to read/write stdin/stdout as unicode and convert
    to/from utf8 when passing to/reading from the core.

    Once again, build with WINDOWS_NO_UNICODE to preserve old behaviour.

    See bug 692770.

    CLUSTER_UNTESTED.