dev-master
9999999-dev https://github.com/marc-mabe/entity-coderEncode & decode XML, HTML and own defined entities into different charsets
BSD-3-Clause
The Requires
- ext-iconv *
- php >=5.3
The Development Requires
xml html entity
Wallogit.com
2017 © Pedro Peláez
Encode & decode XML, HTML and own defined entities into different charsets
Encode & decode XML, HTML and own defined entities into different charsets., (*1)
Encode, (*2)
$entityCoder = new EntityCoder(array(
// set named entity reference
// -> 'special', 'xml', 'html' or an array of your own entities
'entityReference' => 'special',
// set your input charset (default: ISO-8859-1)
'inputCharSet' => 'UTF-8',
// set your output charset (default: ISO-8859-1)
'outputCharSet' => 'ISO-8859-15',
// convert to hex entities if no named entity exists (default: false)
'hex' => true,
));
$text = $entityCoder->encode($text);
Decode, (*3)
$entityCoder = new EntityCoder(array(
// set named entity reference
// -> 'special', 'xml', 'html' or an array of your own entities
'entityReference' => 'html',
// set your input charset (default: ISO-8859-1)
'inputCharSet' => 'ISO-8859-15',
// set your output charset (default: ISO-8859-1)
'outputCharSet' => 'ASCII',
// How to handle invalid characters
// EXCEPTION = throw an exception
// CALLBACK = call a callback
// IGNORE = replace by an empty character
// SUBSTITUTE = substitute by an substitution character (default: "?")
// TRANSLIT_* = convert to ASCII name with a fallback to one of the other actions
'invalidCharAction' => EntityCoder::ACTION_SUBSTITUTE,
// How to handle invalid entities
// EXCEPTION = throw an exception
// CALLBACK = call a callback
// IGNORE = replace by an empty character
// SUBSTITUTE = substitute by an substitution character (default: "?")
// ENTITY = leave the entity as-is
'invalidEntityAction' => EntityCoder::ACTION_ENTITY,
));
$text = $entityCoder->decode($text);
This library requires PHP 5.3.0 or later. Additionally the php extension iconv is needed. (enabled by default), (*4)
If you find code in this release behaving in an unexpected manner or contrary to its documented behavior, please create an issue in the GitHub issue tracker at:, (*5)
https://github.com/marc-mabe/entity-coder/issues, (*6)
The files in this archive are released under the new BSD license. You can find a copy of this license in LICENSE.txt., (*7)
Encode & decode XML, HTML and own defined entities into different charsets
BSD-3-Clause
xml html entity