[Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Jun 17 04:38:31 EDT 2009


Hello Simon,

Wednesday, June 17, 2009, 11:55:15 AM, you wrote:

> Right, so getArgs is already fine.

it's what i've found in Jun15 sources:

#ifdef __GLASGOW_HASKELL__
getArgs :: IO [String]
getArgs =
  alloca $ \ p_argc ->
  alloca $ \ p_argv -> do
   getProgArgv p_argc p_argv
   p    <- fromIntegral `liftM` peek p_argc
   argv <- peek p_argv
   peekArray (p - 1) (advancePtr argv 1) >>= mapM peekCString


foreign import ccall unsafe "getProgArgv"
  getProgArgv :: Ptr CInt -> Ptr (Ptr CString) -> IO ()


it uses peekCString so by any means it cannot produce unicode chars


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list