import XMonad.Util.Run(spawnPipe) import System.IO import System.IO.UTF8 {- ghc 6.12.1 utf8-string-0.3.4 (ghc) utf8-string-0.3.6 -} main :: IO() main = do xmobar <- spawnPipe "/usr/bin/xmobar /home/orbisvicis/.xmonad/xmobar" -- Test#1 System.IO.hPutStrLn xmobar "]·[" {- When output contains utf-8: . : hGetLine: invalid argument (Invalid or incomplete multibyte or wide character) xmobar: : hLookAhead: invalid argument (Invalid or incomplete multibyte or wide character) . no text is output When output contains no utf-8: . no errors, all text is output -} -- Test#2 --System.IO.UTF8.hPutStrLn xmobar "]·[" {- When output contains utf-8: . text is output . utf-8 chars replaced by a question-mark-in-hexagon char * seems to be an xmobar/ghc-6.12.1 error, tested by running xmobar via cli/stdin When output contains no utf-8: . no errors, all text is output -} -- Test#3 --System.IO.hPutStrLn xmobar "]\x21aa[" {- Same result as test#1 -} -- Test#4 --System.IO.UTF8.hPutStrLn xmobar "]\x21aa[" {- When output contains utf8-8: . xmobar: Enum.toEnum{Word8}: tag (8618) is outside of bounds (0,255) . no text is output When output contains no utf-8: . no errors, all text is output -} testIO :: IO() testIO = do input <- System.IO.getLine System.IO.putStrLn input testIO_utf :: IO() testIO_utf = do input <- System.IO.UTF8.getLine System.IO.UTF8.putStrLn input infoMode :: IO() infoMode = do xmobar <- spawnPipe "/usr/bin/xmobar /home/orbisvicis/.xmonad/xmobar" enc <- hGetEncoding xmobar System.IO.putStrLn enc --eM :: Maybe a -> a --eM aybe a = a