#3341: encoding errors could be handled better
--------------------+-------------------------------------------------------
Reporter:  judahj   |          Owner:                
    Type:  bug      |         Status:  new           
Priority:  normal   |      Component:  libraries/base
 Version:  6.11     |       Severity:  normal        
Keywords:           |       Testcase:                
      Os:  MacOS X  |   Architecture:  x86           
--------------------+-------------------------------------------------------
 With the new Unicode I/O library, using the following program
 (`badchar.hs`):
 {{{
 import System.IO
 main = do
     hSetBuffering stdin NoBuffering
     getChar >> print
 }}}
 If the terminal's LANG is utf-8 but a latin-1 non-ASCII character is
 typed, then the terminal hangs and doesn't throw an error until three
 more bytes are entered.  Since `NoBuffering` is set, I'd expect the
 program to
 immediately perform error handling rather than waiting for more input.

 Furthermore, if the end of input is reached then the invalid byte is
 accepted without error.  For example, in a utf-8 terminal:
 {{{
 dhcp-19-155:tmp judah$ ghc -e "putStrLn \"\\249\"" | ./badchar
 '\249'
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3341>
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