<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sjorek / unicode-normalization-stream-filter example snippets
\Sjorek\UnicodeNormalization\StreamFilter::register();
$in_file = fopen('utf8-file.txt', 'r');
$out_file = fopen('utf8-normalized-to-nfc-file.txt', 'w');
// It works as a read filter:
stream_filter_append($in_file, 'convert.unicode-normalization.NFC');
// And it also works as a write filter:
// stream_filter_append($out_file, 'convert.unicode-normalization.NFC');
stream_copy_to_stream($in_file, $out_file);
/**
* @var $stream resource The stream to filter.
* @var $form string The form to normalize unicode to.
* @var $read_write int STREAM_FILTER_* constant to override the filter injection point
*
* @link http://php.net/manual/en/function.stream-filter-append.php
* @link http://php.net/manual/en/function.stream-filter-prepend.php
*/
stream_filter_append($stream, "convert.unicode-normalization.$form", $read_write);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.