Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/marcelog/simple_utf8

Simple utf8 to binary and viceversa translation routines for Erlang
https://github.com/marcelog/simple_utf8

Last synced: 15 days ago
JSON representation

Simple utf8 to binary and viceversa translation routines for Erlang

Awesome Lists containing this project

README

        

# Simple UTF8 to/from binaries routines

## About
This was done just for fun. Valid sequences include 1, 2, 3, 4, 5, and 6 bytes
long.

## Binaries to UTF8 pointcodes

simple_utf8:bin_to_cp(Bin).

## UTF8 pointcodes to binaries

simple_utf8:cp_to_bin(CodePoints).

## Example
1> Utf8Bin = simple_utf8:cp_to_bin("中國哲學書電子化計劃").
<<228,184,173,229,156,139,229,147,178,229,173,184,230,155,
184,233,155,187,229,173,144,229,140,150,232,168,136,229,
138,...>>
2> "中國哲學書電子化計劃" = simple_utf8:bin_to_cp(Utf8Bin).
[20013,22283,21746,23416,26360,38651,23376,21270,35336,
21123]