unicode-show
$ cabal install unicode-show
Installed unicode-show-0.1.0.2
Prelude> :m +Text.Show.Unicode
Prelude Text.Show.Unicode>
unicode-show 这个库可用于向控制台窗口输出 Unicode 字符。
Prelude Text.Show.Unicode> ("Хорошо!",["哈斯克尔7.6.1的力量","感じる"])
("106110861088108610961086!",["21704260312081123572&7.6.1303402114737327","248631237612427"])
Prelude Text.Show.Unicode> uprint it
"("Хорошо!",["哈斯克尔7.6.1的力量","感じる"])"
Prelude Text.Show.Unicode> :set -interactive-print=Text.Show.Unicode.uprint
Prelude Text.Show.Unicode> it
("Хорошо!",["哈斯克尔7.6.1的力量","感じる"])
hxt-unicode
$ cabal install hxt-unicode
Installed hxt-unicode-9.0.2.4
Prelude> import Data.String.Unicode
Prelude Data.String.Unicode>
hxt-unicode 这个库可用于在不同的 coding 之间转换。
Prelude Data.String.Unicode> unicodeToUtf8 "Хорошо!"
"208165208190209128208190209136208190!"
Prelude Data.String.Unicode> unicodeToUtf8 "哈斯克尔7.6.1的力量"
"229147136230150175229133139229176148&7.6.1231154132229138155233135143"
Prelude Data.String.Unicode> unicodeToUtf8 "感じる"
"230132159227129152227130139"
utf8-string
$ cabal install utf8-string
Installed utf8-string-1.0.1.1
Prelude> import Data.ByteString.UTF8
Prelude Data.ByteString.UTF8>
utf8-string 这个库可用于将字符串转换成 UTF8 字符串。
Prelude Data.ByteString.UTF8> fromString "Хорошо!"
"208165208190209128208190209136208190!"
Prelude Data.ByteString.UTF8> fromString "哈斯克尔7.6.1的力量"
"229147136230150175229133139229176148&7.6.1231154132229138155233135143"
Prelude Data.ByteString.UTF8> fromString "感じる"
"230132159227129152227130139"