[GHC] #5061: Implement FFI spec behaviour for *CString family

GHC cvs-ghc at haskell.org
Sun Apr 3 19:43:50 CEST 2011


#5061: Implement FFI spec behaviour for *CString family
---------------------------------+------------------------------------------
    Reporter:  batterseapower    |        Owner:              
        Type:  bug               |       Status:  patch       
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  7.0.3       
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by batterseapower):

 With PEP-383 behaviour, yes: if you decode the string using the locale
 decoding (and handling surrogates by turning them back into bytes) you
 should get exactly the same bytes as originally came in.

 The only downside is you need to *en*code with the same method as was
 originally used to *de*code. So if the command line arguments were decoded
 e.g. Shift-JIS there would be no guarantee that encoding them back to
 bytes with UTF-8 will work. However, if we stick to the policy of always
 decoding using the locale encoding, the user will be able to reliably use
 the locale encoding to get raw bytes out of a String that exactly match
 what we originally decoded.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5061#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list