简体   繁体   中英

How do I deal with non-ASCII characters in IO operations?

As the title says, I'm having a problem dealing with characters outside of ASCII (like 'á','ã', etc) in IO operations. Look at the example (Unix environment):

import System.Cmd
system "ls aaaá"

Which returns the ls command code error:

(...)ls: can't access "aaa�" : no such file or directory(...)

How can I fix this?

根据hammar的评论,我安装了GHC v7.2.2(我的旧版本是v6.9.9),并且修复了错误。

  1. Check your system locale
  2. Check the encoding of your Haskell sources

If both are UTF8 it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM