Skip to content

Commit fa82e98

Browse files
committed
Merge branch 'master' of github.com:neitanod/ForceUTF8
2 parents abf5082 + 75e3615 commit fa82e98

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@ will output:
4646
Fédération Camerounaise de Football
4747
Fédération Camerounaise de Football
4848
Fédération Camerounaise de Football
49+
50+
Options:
51+
========
52+
By default, `Encoding::fixUTF8` will use the `Encoding::WITHOUT_ICONV` flag, signalling that iconv should not be used to fix garbled UTF8 strings.
53+
54+
This class also provides options for iconv processing, such as `Encoding::ICONV_TRANSLIT` and `Encoding::ICONV_IGNORE` to enable these flags when the iconv class is utilized. The functionality of such flags are documented in the [PHP iconv documentation](http://php.net/manual/en/function.iconv.php).
55+
56+
Examples:
57+
58+
use \ForceUTF8\Encoding;
59+
60+
$str = "Fédération Camerounaise—de—Football\n"; // Uses U+2014 which is invalid
61+
echo Encoding::fixUTF8($str); // Breaks invalid char (U+2014)
62+
echo Encoding::fixUTF8($str, Encoding::ICONV_TRANSLIT);
63+
echo Encoding::fixUTF8($str, Encoding::ICONV_TRANSLIT);
64+
65+
will output:
66+
67+
Fédération Camerounaise?de?Football
68+
Fédération Camerounaise—de—Football
69+
Fédération Camerounaise—de—Football
4970

5071
Install via composer:
5172
=====================

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "neitanod/forceutf8",
33
"homepage": "https://github.com/neitanod/forceutf8",
4+
"license": "BSD-3-Clause",
45
"type": "library",
56
"description": "PHP Class Encoding featuring popular Encoding::toUTF8() function --formerly known as forceUTF8()-- that fixes mixed encoded strings.",
67
"require": {

0 commit comments

Comments
 (0)