Using Haskell to output a UTF-8-encoded ByteString

后端 未结 3 1534
时光取名叫无心
时光取名叫无心 2020-12-15 17:35

I\'m going out of my mind trying to simply output UTF-8-encoded data to the console.

I\'ve managed to accomplish this using String, but now I\'d like to

3条回答
  •  余生分开走
    2020-12-15 18:10

    utf8-string supports bytestrings.

    import Prelude hiding (putStr)
    import Data.ByteString.Char8 (putStr)
    import Data.ByteString.UTF8 (fromString)
    
    main :: IO ()
    main = putStr $ fromString "čušpajž日本語"
    

提交回复
热议问题