zoukankan      html  css  js  c++  java
  • Haskell语言学习笔记(89)Unicode UTF8

    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"
    
  • 相关阅读:
    BZOJ1969: [Ahoi2005]LANE 航线规划
    BZOJ1800: [Ahoi2009]fly 飞行棋
    BZOJ2661: [BeiJing wc2012]连连看
    BZOJ2464: 中山市选[2009]小明的游戏
    BZOJ2440: [中山市选2011]完全平方数
    BZOJ2226: [Spoj 5971] LCMSum
    Codeforces 610B
    Codeforces 757B
    Codeforces B
    HDU 6090 Rikka with Graph
  • 原文地址:https://www.cnblogs.com/zwvista/p/9426245.html
Copyright © 2011-2022 走看看