phplang / base65536
Base65536 编码/解码工具
1.0.0
2017-06-25 17:35 UTC
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^6.0.0
This package is not auto-updated.
Last update: 2024-09-15 04:05:30 UTC
README
Base65536 是一种针对 UTF-32 编码文本和 Twitter 进行优化的二进制编码。这个 PHP Composer 包,phplang/base65536
,松散地基于 qntm/base65536。
用法
use \PhpLang\Base65536; $buf = 'hello world'; $str = Base65536::encode($buf); echo $str; // 6 codes points, '驨ꍬ啯𒁷ꍲᕤ' var_dump($buf === Base65536::decode($str)); // bool(true)
注意
根据规范,decode()
的输入和 encode()
的输出默认使用的编码是 CESU-8,它是 UTF-8
的一种变体,用于编码分割的 UTF-16
代理对。如果您需要真正的 UTF-8
输出,您必须通过 encode()
和 decode()
的第二个参数指定。
许可证
MIT,以匹配原始项目的慷慨许可。 :D