cl-scsu

2016-05-31

Abstract

Standard Compression Scheme for Unicode ? Common Lisp ???

cl-scsu is an implementation of Standard Compression Scheme for Unicode by Common Lisp.

License

The MIT License. See LICENSE file.

Loading

Libraries depending on

  • asdf
  • alexandria

Loading

(load "cl-scsu.asd")
(asdf:load-system :cl-scsu)

For running tests, do below additionally.

(load "cl-scsu-test.asd")
(asdf:test-system :cl-scsu)

Examples

Makes a test string, estimated 38 bytes long by counting Japanese characters as 2 bytes.

CL-USER> (defvar *test-string* "abcde ????? ????? ?????")
*TEST-STRING*

Let's compress it. The result is only 30 bytes long.

CL-USER> (cl-scsu:encode-from-string *test-string*)
#(97 98 99 100 101 32 21 130 132 134 136 138 32 226 228 230 232 234 32
  15 150 63 79 10 91 135 108 95 101 188) ; compressin result
30                                       ; number of result bytes
23                                       ; number of read characters
#<CL-SCSU:SCSU-STATE @ #x10002ed37c2>    ; scsu state object

To restore the original string, decompress the bytes.

CL-USER> (cl-scsu:decode-to-string *)
"abcde ????? ????? ?????" ; decompression result
23                                       ; number of result characters
30                                       ; number of read bytes
#<CL-SCSU:SCSU-STATE @ #x10002f469f2>    ; scsu state object

API

see API.md.

Author
YOKOTA Yuki <y2q.actionman@gmail.com>
License
MIT