text-media / encoding-converter
v1.0.1
2018-01-26 08:12 UTC
Requires (Dev)
- phpunit/phpunit: ^5.6
- squizlabs/php_codesniffer: ^3.1
This package is auto-updated.
Last update: 2024-09-29 03:57:59 UTC
README
定义文本编码和转换的包。
安装
将仓库和依赖项添加到 composer.json,如下所示
composer require text-media/encoding-converter
使用
使用示例
use \TextMedia\EncodingConverter\{Converter, Detector};
// определение кодировки
$charset = Detector::detect($text);
// конвертирование из кодировки A в B
$encoded = Converter::encode($text, $b, $a);
// автоопределение кодировки и конвертирование в C
$encoded = Converter::encode($text, $c);
// автоопределение кодировки и конвертирование в UTF-8
$encoded = Converter::encode($text);
测试
在项目根目录下执行
./vendor/bin/phpunit -c ./