Lines Matching refs:mb_detect_encoding

2 mb_detect_encoding()
22 print("Empty String: " . mb_detect_encoding('') . "\n");
23 print("Bad ASCII (non-strict): " . mb_detect_encoding("\xDD\x92", ['ASCII', 'UTF-8'], false) . "\n"…
24 print("Bad ASCII (strict): " . mb_detect_encoding("\xDD\x92", ['ASCII', 'UTF-8'], true) . "\n");
25 print("Bad ASCII/UTF-8, with more errors for ASCII (non-strict): " . mb_detect_encoding("\xD6\x8A\x…
26 print("Bad ASCII/UTF-8, with more errors for ASCII (strict): " . var_export(mb_detect_encoding("\xD…
28 print("UTF-8 BOM (non-strict): " . mb_detect_encoding("\xEF\xBB\xBF", ["UTF-8", "ASCII"], false) . …
29 print("UTF-8 BOM (strict): " . mb_detect_encoding("\xEF\xBB\xBF", ["UTF-8", "ASCII"], true) . "\n");
30 print("UTF-16BE BOM (non-strict): " . mb_detect_encoding("\xFE\xFF", ["UTF-8", "UTF-16BE", "UTF-16L…
31 print("UTF-16BE BOM (strict): " . mb_detect_encoding("\xFE\xFF", ["UTF-8", "UTF-16BE", "UTF-16LE"],…
32 print("UTF-16LE BOM (non-strict): " . mb_detect_encoding("\xFF\xFE", ["UTF-8", "UTF-16BE", "UTF-16L…
33 print("UTF-16LE BOM (strict): " . mb_detect_encoding("\xFF\xFE", ["UTF-8", "UTF-16BE", "UTF-16LE"],…
35 print("SJIS: " . mb_detect_encoding($sjis, 'SJIS', true) . "\n");
36 print("JIS: " . mb_detect_encoding($jis, 'JIS', true) . "\n");
37 print("EUC-JP (strict): " . mb_detect_encoding($euc_jp, 'UTF-8,EUC-JP,JIS', true) . "\n");
38 print("EUC-JP (non-strict): " . mb_detect_encoding($euc_jp, 'UTF-8,EUC-JP,JIS', false) . "\n");
39 print("EUC-JP (fewer choices): " . mb_detect_encoding($euc_jp, 'JIS,EUC-JP') . "\n");
40 print("UTF-8, polish string 1 (strict): " . mb_detect_encoding($polish1, 'UTF-8,UTF-16,ISO-8859-1',…
41 print("UTF-8, polish string 1 (non-strict): " . mb_detect_encoding($polish1, 'UTF-8,UTF-16,ISO-8859…
42 print("UTF-8, polish string 2 (strict): " . mb_detect_encoding($polish2, 'UTF-8,UTF-16,ISO-8859-1',…
43 print("UTF-8, polish string 2 (non-strict): " . mb_detect_encoding($polish2, 'UTF-8,UTF-16,ISO-8859…
48 print("JIS: " . mb_detect_encoding($jis, $a) . "\n");
49 print("EUC-JP: " . mb_detect_encoding($euc_jp, $a) . "\n");
50 print("SJIS: " . mb_detect_encoding($sjis, $a) . "\n");
61 echo mb_detect_encoding($test, $encodings), "\n";
65 echo mb_detect_encoding($test, ['UTF-8', 'SJIS']), "\n";
76 echo mb_detect_encoding($test, ['UTF-8', 'UTF-16']), "\n";
79 echo mb_detect_encoding($test, ['UTF-8', 'ISO-8859-1']), "\n"; // Should be UTF-8
82 echo mb_detect_encoding($test, ['UTF-8', 'ISO-8859-1']), "\n"; // Should be UTF-8
85 echo mb_detect_encoding('abc', ['UUENCODE', 'UTF-8']), "\n";
86 echo mb_detect_encoding('abc', ['UUENCODE', 'QPrint', 'HTML-ENTITIES', 'Base64', '7bit', '8bit', 'S…
93 echo mb_detect_encoding($css, mb_list_encodings(), true), "\n";
98 echo mb_detect_encoding("Total Māori,31.5,33.3,31.8,33,36.4,33.2,33.2", ['UTF-8', 'ISO-8859-1', 'Wi…
100 echo mb_detect_encoding("Kākā", ['UTF-8', 'ISO-8859-1', 'Windows-1251']), "\n";
101 echo mb_detect_encoding("Whēkau", ['UTF-8', 'ISO-8859-1', 'Windows-1251']), "\n";
102 echo mb_detect_encoding("Tīwaiwaka", ['UTF-8', 'ISO-8859-1', 'Windows-1251']), "\n";
103 echo mb_detect_encoding("Kōtuku", ['UTF-8', 'ISO-8859-1', 'Windows-1251']), "\n";
104 echo mb_detect_encoding("Kererū", ['UTF-8', 'ISO-8859-1', 'Windows-1251']), "\n";
105 echo mb_detect_encoding("Tūī", ['UTF-8', 'ISO-8859-1', 'Windows-1251']), "\n";
111 print("JIS: " . mb_detect_encoding($jis) . "\n");
113 print("EUC-JP: " . mb_detect_encoding($euc_jp) . "\n");
115 print("SJIS: " . mb_detect_encoding($sjis) . "\n");
120 // but mb_detect_encoding still guesses UTF-8 because it is the first one in the list
123 echo mb_detect_encoding($win1252text, ['UTF-8', 'CP1252', 'ISO-8859-1'], true), "\n";
126 echo mb_detect_encoding($utf8text, ['UTF-8', 'CP1252', 'ISO-8859-1'], true), "\n";
130 print("INT: " . mb_detect_encoding(1234, 'EUC-JP') . "\n"); // EUC-JP
132 print("EUC-JP: " . mb_detect_encoding('', 'EUC-JP') . "\n"); // SJIS
135 var_dump(mb_detect_encoding($euc_jp, 'BAD'));
143 var_dump(mb_detect_encoding($str, ['UTF-8', 'ISO-8859-1'], true));
146 var_dump(mb_detect_encoding("\xFE\xFF\x4E\x4E", ['UTF-8', 'ISO-8859-1', 'UTF-16LE', 'UTF-16BE'], tr…
147 var_dump(mb_detect_encoding("\xFF\xFE\x4E\x4E", ['UTF-8', 'ISO-8859-1', 'UTF-16LE', 'UTF-16BE'], tr…
149 $detected = mb_detect_encoding("\x4E\x4E\xFE\xFF\x4E\x4E", ['UTF-8', 'ISO-8859-1', 'UTF-16LE', 'UTF…
158 if (mb_detect_encoding($str, $encodings, true) === $encoding)
159 …die("mb_detect_encoding should never return " . $encoding . " for invalid input string " . bin2hex…
170 $detected = mb_detect_encoding($converted, $encodings);
172 echo "BAD! mb_detect_encoding returned $detected (should have been $encoding)\n";
453 mb_detect_encoding(): Argument #2 ($encodings) contains invalid encoding "BAD"