[![Build Status](https://travis-ci.org/voku/portable-utf8.svg?branch=master)](https://travis-ci.org/voku/portable-utf8)
[![Build status](https://ci.appveyor.com/api/projects/status/gnejjnk7qplr7f5t/branch/master?svg=true)](https://ci.appveyor.com/project/voku/portable-utf8/branch/master)
[![Coverage Status](https://coveralls.io/repos/voku/portable-utf8/badge.svg?branch=master&service=github)](https://coveralls.io/github/voku/portable-utf8?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/voku/portable-utf8/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/voku/portable-utf8/?branch=master)
[![Codacy Badge](https://www.codacy.com/project/badge/997c9bb10d1c4791967bdf2e42013e8e)](https://www.codacy.com/app/voku/portable-utf8)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/be5bf087-366c-463e-ac9f-c184db6347ba/mini.png)](https://insight.sensiolabs.com/projects/be5bf087-366c-463e-ac9f-c184db6347ba)
[![Dependency Status](https://www.versioneye.com/php/voku:portable-utf8/dev-master/badge.svg)](https://www.versioneye.com/php/voku:portable-utf8/dev-master)
[![Reference Status](https://www.versioneye.com/php/voku:portable-utf8/reference_badge.svg?style=flat)](https://www.versioneye.com/php/voku:portable-utf8/references)
[![Latest Stable Version](https://poser.pugx.org/voku/portable-utf8/v/stable)](https://packagist.org/packages/voku/portable-utf8)
[![Total Downloads](https://poser.pugx.org/voku/portable-utf8/downloads)](https://packagist.org/packages/voku/portable-utf8)
[![Latest Unstable Version](https://poser.pugx.org/voku/portable-utf8/v/unstable)](https://packagist.org/packages/voku/portable-utf8)
[![License](https://poser.pugx.org/voku/portable-utf8/license)](https://packagist.org/packages/voku/portable-utf8)
# Portable UTF-8
## Description
It is written in PHP (PHP 5.3+, PHP 7) and can work without "mbstring", "iconv" or any other extra encoding php-extension on your server.
The benefit of Portable UTF-8 is that it is easy to use, easy to bundle. This library will also
auto-detect your server environment and will use the installed php-extensions if they are available,
so you will have the best possible performance.
As fallback we will use Symfony Polyfills, if needed. (https://github.com/symfony/polyfill)
The project based on ...
+ Hamid Sarfraz's work (http://pageconfig.com/attachments/portable-utf8.php)
+ Nicolas Grekas's work (https://github.com/tchwork/utf8)
+ Behat's work (https://github.com/Behat/Transliterator)
+ Sebastián Grignoli's work (https://github.com/neitanod/forceutf8)
+ Ivan Enderlin's work (https://github.com/hoaproject/Ustring)
+ and many cherry-picks from "github"-gists and "Stack Overflow"-snippets ...
## Index
* [Alternative](#alternative)
* [Install](#install-portable-utf-8-via-composer-require)
* [Why Portable UTF-8?](#why-portable-utf-8)
* [Requirements and Recommendations](#requirements-and-recommendations)
* [Warning](#warning)
* [Usage](#usage)
* [Class methods](#class-methods)
* [access](#accessstring-str-int-pos)
* [add_bom_to_string](#add_bom_to_stringstring-str)
* [binary_to_str](#binary_to_strmixed-bin)
* [bom](#bom)
* [chr](#chrint-code_point--string)
* [chr_map](#chr_mapstringarray-callback-string-str--array)
* [chr_size_list](#chr_size_liststring-str--array)
* [chr_to_decimal](#chr_to_decimalstring-chr--int)
* [chr_to_hex](#chr_to_hexstring-chr-string-pfix--u)
* [chunk_split](#chunk_splitstring-body-int-chunklen--76-string-end--rn--string)
* [clean](#cleanstring-str-bool-remove_bom--false-bool-normalize_whitespace--false-bool-normalize_msword--false-bool-keep_non_breaking_space--false--string)
* [cleanup](#cleanupstring-str--string)
* [codepoints](#codepointsmixed-arg-bool-u_style--false--array)
* [count_chars](#count_charsstring-str-bool-cleanutf8--false--array)
* [encode](#encodestring-encoding-string-str-bool-force--true--string)
* [file_get_contents](#file_get_contentsstring-filename-intnull-flags--null-resourcenull-context--null-intnull-offset--null-intnull-maxlen--null-int-timeout--10-bool-converttoutf8--true--string)
* [file_has_bom](#file_has_bomstring-file_path--bool)
* [filter](#filtermixed-var-int-normalization_form--4-string-leading_combining----mixed)
* [filter_input](#filter_inputint-type-string-var-int-filter--filter_default-nullarray-option--null--string)
* [filter_input_array](#filter_input_arrayint-type-mixed-definition--null-bool-add_empty--true--mixed)
* [filter_var](#filter_varstring-var-int-filter--filter_default-array-option--null--string)
* [filter_var_array](#filter_var_arrayarray-data-mixed-definition--null-bool-add_empty--true--mixed)
* [fits_inside](#fits_insidestring-str-int-box_size--bool)
* [fix_simple_utf8](#fix_simple_utf8string-str--string)
* [fix_utf8](#fix_utf8stringstring-str--mixed)
* [getCharDirection](#getchardirectionstring-char--string-rtl-or-ltr)
* [hex_to_int](#hex_to_intstring-str--intfalse)
* [html_encode](#html_encodestring-str-bool-keepasciichars--false-string-encoding--utf-8--string)
* [html_entity_decode](#html_entity_decodestring-str-int-flags--null-string-encoding--utf-8--string)
* [htmlentities](#htmlentitiesstring-str-int-flags--ent_compat-string-encoding--utf-8-bool-double_encode--true--string)
* [htmlspecialchars](#htmlspecialcharsstring-str-int-flags--ent_compat-string-encoding--utf-8-bool-double_encode--true--string)
* [int_to_hex](#int_to_hexint-int-string-pfix--u--str)
* [is_ascii](#is_asciistring-str--bool)
* [is_base64](#is_base64string-str--bool)
* [is_binary](#is_binarymixed-input--bool)
* [is_binary_file](#is_binary_filestring-file--bool)
* [is_bom](#is_bomstring-str--bool)
* [is_json](#is_jsonstring-str--bool)
* [is_html](#is_htmlstring-str--bool)
* [is_utf16](#is_utf16string-str--intfalse)
* [is_utf32](#is_utf32string-str--intfalse)
* [is_utf8](#is_utf8string-str-bool-strict--false--bool)
* [json_decode](#json_decodestring-json-bool-assoc--false-int-depth--512-int-options--0--mixed)
* [json_encode](#json_encodemixed-value-int-options--0-int-depth--512--string)
* [lcfirst](#lcfirststring-str--string)
* [max](#maxmixed-arg--string)
* [max_chr_width](#max_chr_widthstring-str--int)
* [min](#minmixed-arg--string)
* [normalize_encoding](#normalize_encodingstring-encoding--string)
* [normalize_msword](#normalize_mswordstring-str--string)
* [normalize_whitespace](#normalize_whitespacestring-str-bool-keepnonbreakingspace--false-bool-keepbidiunicodecontrols--false--string)
* [ord](#ordstring-chr--int)
* [parse_str](#parse_strstring-str-result--bool)
* [range](#rangemixed-var1-mixed-var2--array)
* [remove_bom](#remove_bomstring-str--string)
* [remove_duplicates](#remove_duplicatesstring-str-stringarray-what-----string)
* [remove_invisible_characters](#remove_invisible_charactersstring-str-bool-url_encoded--true-string-replacement----string)
* [replace_diamond_question_mark](#replace_diamond_question_markstring-str-string-unknown----string)
* [trim](#trimstring-str---string-chars--inf--string)
* [rtrim](#rtrimstring-str---string-chars--inf--string)
* [ltrim](#ltrimstring-str-string-chars--inf--string)
* [single_chr_html_encode](#single_chr_html_encodestring-char-bool-keepasciichars--false--string)
* [split](#splitstring-str-int-length--1-bool-cleanutf8--false--array)
* [str_detect_encoding](#str_detect_encodingstring-str--string)
* [str_ireplace](#str_ireplacemixed-search-mixed-replace-mixed-subject-int-count--null--mixed)
* [str_limit_after_word](#str_limit_after_wordstring-str-int-length--100-stirng-straddon----string)
* [str_pad](#str_padstring-str-int-pad_length-string-pad_string----int-pad_type--str_pad_right--string)
* [str_repeat](#str_repeatstring-str-int-multiplier--string)
* [str_shuffle