Ratings | | Unique User Downloads | | Download Rankings |
Not enough user ratings | | Total: 131 | | All time: 9,352 This week: 36 |
|
Description | | Author |
This class can convert latin characters that were double-encoded.
It can take as parameter a string that has latin characters with accents and cedillas but were encoded twice as utf8.
The class replaces the double encoded latin characters with the correct characters in UTF-8.
It can also check if a string has a correct representation of text string in UTF-8. Innovation Award
 February 2021
Winner
Prize: SourceGuarding PHP encoder tool |
Sometimes applications store text that was given by the application users using UTF-8 encoded.
However, due to programming mistakes, the application may encode the text again as UTF-8, when it was already encoded as UTF-8. This mistake is called double-encoding.
To fix the text that was double encoded, it it is necessary to revert the last step of encoding of the characters.
This class provides a solution, that not only can undo the double-encoding mistake, but it is also able to detect the encoding of a given text, so you can evaluate what encoding it is using.
Manuel Lemos |
| |
 |
|
Innovation award
 Nominee: 2x
Winner: 1x |
|
Example
<?php
/***************************************************************************************
Examples Using Class Utf8DecodeFrenchAccentsEncoded
***************************************************************************************/
require_once 'Utf8DecodeFrenchAccentsEncoded.php';
$classDecodeUtf8Fr = new Utf8DecodeFrenchAccentsEncoded();
$example1 ="PHPCLASSES est déjà le meilleur site.";
$example2 ="PHPCLASSES est déjà le meilleur site.";
$example3 ="PHPCLASSES est déjà le meilleur site.";
$example4 ="PHPCLASSES est d0233j0225 le meilleur site.";
echo "-------------------------------- <b>Before using Class Utf8DecodeFrenchAccentsEncoded</b> ---------------------------<br><br>";
echo "<b>Example1</b> :: ".$example1."<br><br>";
echo "<b>Example2</b> :: ".$example2."<br><br>";
echo "<b>Example3</b> :: ".$example3."<br><br>";
echo "<b>Example4</b> :: ".$example4."<br><br>";
echo "-------------------------------- <b>After using Class Utf8DecodeFrenchAccentsEncoded</b> -----------------------------<br><br>";
echo "<b>Example1 with preg_replace</b> :: ".$classDecodeUtf8Fr->fr_utf8_decode_with_preg_replace($example1)."<br><br>";
echo "<b>Example1 with str_replace</b> :: ".$classDecodeUtf8Fr->fr_utf8_decode_str_replace($example1)."<br><br>";
echo "<b>Example2</b> :: ".$classDecodeUtf8Fr->fr_utf8_decode_with_preg_replace($example2)."<br><br>";
echo "<b>Example3</b> :: ".$classDecodeUtf8Fr->fr_utf8_decode_with_preg_replace($example3)."<br><br>";
echo "<b>Example4</b> :: ".$classDecodeUtf8Fr->fr_utf8_decode_with_preg_replace($example4)."<br><br>";
|
Details
PHP-Utf8-Decode-French-Accents-Encoded
This PHP class can decode UTF8 encoded strings for French special characters.
It extends the Utf8DecodeFrenchAccentsEncoded PHP class to provide functions that can detects character encoding on a given string and can decode utf8 encoded Accents characters of French language.
The class functions take the string encoded as parameter to show the string decode in utf8. For is_utf8() function, it return a boolean.
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.