#3398: Unicode output in GHC
---------------------------------+------------------------------------------
    Reporter:  simonmar          |        Owner:                  
        Type:  bug               |       Status:  new             
    Priority:  high              |    Milestone:  6.12.1          
   Component:  Compiler          |      Version:  6.11            
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:  2816              |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Comment (by judahj):

 This plan sounds good to me.

 For Windows code-page encoding: I've got a prototype library for this.  I
 will work on integrating it into the base library.

 There's another issue with this proposal, specifically printing Unicode
 !FilePaths in error messages.  For example, with ghc-6.10.3 and a utf-8
 terminal:
 {{{
 jj-macbook:uni-test $ ghci fooα/Foo.hs
 [snip]
 fooα/Foo.hs:2:0: parse error (possibly incorrect indentation)
 Failed, modules loaded: none.
 Prelude> :r

 fooα/Foo.hs:2:0: parse error (possibly incorrect indentation)
 Failed, modules loaded: none.
 }}}

 This happens because the encoded !FilePath is embedded inside the error
 message as a String, so Haskeline (I think) re-encodes it before printing
 it out.

 Eventually, we'll need to solve #3307 and #3309 (better handling of
 Unicode getArgs and !FilePaths).  However, that's part of a larger
 discussion which won't be completed in the next month.  So, I propose that
 we:

  1) Add {{{filePathToPrintableString :: FilePath -> IO String}}} .  On
 Windows this does nothing; on Unix it uses iconv to decode the !FilePath
 and %-encode each undecodable byte.

  2) Make GHC keep track of the printable String of each module's
 !FilePath, to be used when constructing error messages.

 Does that sound feasible?  I can implement at least the first part and
 propose it to the libraries list.  (I'd also like to use it within
 Haskeline itself.)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3398#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to