How do I handle non-ASCII characters in I / O?

As the name says, I have a problem with characters outside of ASCII (for example, "รก", "รฃ", etc.) in I / O operations. See an example (Unix environment):

import System.Cmd system "ls aaaรก" 

Returning the ls command code error:

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

How can i fix this?

+4
source share
2 answers

Based on a hammar comment, I installed GHC v7.2.2 (my old version was v6.9.9) and the error was fixed.

+1
source
  • Check your system language
  • Check Haskell source encoding

If both are UTF8, it should work.

0
source

Source: https://habr.com/ru/post/1387979/


All Articles