| @@ 183-200 (lines=18) @@ | ||
| 180 | $s = str_replace(array("\r\n", "\r"), "\n", $s); |
|
| 181 | } |
|
| 182 | ||
| 183 | if (preg_match('/[\x80-\xFF]/', $s)) { |
|
| 184 | if (Normalizer::isNormalized($s, $normalization_form)) { |
|
| 185 | $n = '-'; |
|
| 186 | } else { |
|
| 187 | $n = Normalizer::normalize($s, $normalization_form); |
|
| 188 | if (isset($n[0])) { |
|
| 189 | $s = $n; |
|
| 190 | } else { |
|
| 191 | $s = UTF8::encode('UTF-8', $s); |
|
| 192 | } |
|
| 193 | } |
|
| 194 | ||
| 195 | if ($s[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $s)) { |
|
| 196 | // Prevent leading combining chars |
|
| 197 | // for NFC-safe concatenations. |
|
| 198 | $s = $leading_combining . $s; |
|
| 199 | } |
|
| 200 | } |
|
| 201 | ||
| 202 | return $s; |
|
| 203 | } |
|
| @@ 2735-2753 (lines=19) @@ | ||
| 2732 | // Workaround https://bugs.php.net/65732 |
|
| 2733 | $var = str_replace(array("\r\n", "\r"), "\n", $var); |
|
| 2734 | } |
|
| 2735 | if (preg_match('/[\x80-\xFF]/', $var)) { |
|
| 2736 | if (Normalizer::isNormalized($var, $normalization_form)) { |
|
| 2737 | $n = '-'; |
|
| 2738 | } else { |
|
| 2739 | $n = Normalizer::normalize($var, $normalization_form); |
|
| 2740 | ||
| 2741 | if (isset($n[0])) { |
|
| 2742 | $var = $n; |
|
| 2743 | } else { |
|
| 2744 | $var = self::encode('UTF-8', $var); |
|
| 2745 | } |
|
| 2746 | ||
| 2747 | } |
|
| 2748 | if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) { |
|
| 2749 | // Prevent leading combining chars |
|
| 2750 | // for NFC-safe concatenations. |
|
| 2751 | $var = $leading_combining . $var; |
|
| 2752 | } |
|
| 2753 | } |
|
| 2754 | break; |
|
| 2755 | } |
|
| 2756 | ||