Hello Gwern,
Monday, June 1, 2009, 4:35:25 AM, you wrote:
> GHC mangles UTF by default. You probably want to use one of the utf8
> packages; eg.
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string
> or
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-light
> (Neither of them seems to allow for accessing *arguments* rather than
> stdin/stdout, but you could probably do something with the
> encoding/decoding functions.)
in order to get proper unicode handling, one should ask win api
directly for cmdline:
myGetArgs = do
alloca $ \p_argc -> do
p_argv_w <- commandLineToArgvW getCommandLineW p_argc
argc <- peek p_argc
argv_w <- peekArray (i argc) p_argv_w
mapM peekTString argv_w >>== tail
foreign import stdcall unsafe "windows.h GetCommandLineW"
getCommandLineW :: LPTSTR
foreign import stdcall unsafe "windows.h CommandLineToArgvW"
commandLineToArgvW :: LPCWSTR -> Ptr CInt -> IO (Ptr LPWSTR)
--
Best regards,
Bulatmailto:bulat.zigans...@gmail.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe