libutf

UTF-8 library
git clone git://git.suckless.org/libutf
Log | Files | Refs | README | LICENSE

README (838B)


      1 libutf
      2 ------
      3 
      4 This is a C89 UTF-8 library, with an API compatible with that of Plan 9's
      5 libutf, but with a number of improvements:
      6 
      7  * Support for runes beyond the Basic Multilingual Plane.
      8  * utflen and utfnlen cannot overflow on 32- or 64-bit machines.
      9  * chartorune treats all invalid codepoints (as per RFC 3629) as though U+FFFD.
     10  * fullrune, utfecpy, and utfnlen do not overestimate the length of malformed
     11     runes.
     12  * An extra function, charntorune(p,s,n), equivalent to
     13     fullrune(s,n)?chartorune(p,s):0.
     14 
     15 Differences to be aware of:
     16 
     17  * UTFmax is 6, though runetochar will never write more than 4 bytes. Plan 9's
     18     UTFmax is 3.
     19  * chartorune may consume multiple bytes for each illegal rune; Plan 9 always
     20     consumes 1.
     21  * runelen and runetochar return 0 if the rune is too large; Plan 9 erroneously
     22     returns UTFmax.