| @@ 185-202 (lines=18) @@ | ||
| 182 | $s = str_replace(array("\r\n", "\r"), "\n", $s); |
|
| 183 | } |
|
| 184 | ||
| 185 | if (preg_match('/[\x80-\xFF]/', $s)) { |
|
| 186 | if (Normalizer::isNormalized($s, $normalization_form)) { |
|
| 187 | $n = '-'; |
|
| 188 | } else { |
|
| 189 | $n = Normalizer::normalize($s, $normalization_form); |
|
| 190 | if (isset($n[0])) { |
|
| 191 | $s = $n; |
|
| 192 | } else { |
|
| 193 | $s = UTF8::encode('UTF-8', $s); |
|
| 194 | } |
|
| 195 | } |
|
| 196 | ||
| 197 | if ($s[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $s)) { |
|
| 198 | // Prevent leading combining chars |
|
| 199 | // for NFC-safe concatenations. |
|
| 200 | $s = $leading_combining . $s; |
|
| 201 | } |
|
| 202 | } |
|
| 203 | ||
| 204 | return $s; |
|
| 205 | } |
|
| @@ 2407-2425 (lines=19) @@ | ||
| 2404 | // Workaround https://bugs.php.net/65732 |
|
| 2405 | $var = str_replace(array("\r\n", "\r"), "\n", $var); |
|
| 2406 | } |
|
| 2407 | if (preg_match('/[\x80-\xFF]/', $var)) { |
|
| 2408 | if (\Normalizer::isNormalized($var, $normalization_form)) { |
|
| 2409 | $n = '-'; |
|
| 2410 | } else { |
|
| 2411 | $n = \Normalizer::normalize($var, $normalization_form); |
|
| 2412 | ||
| 2413 | if (isset($n[0])) { |
|
| 2414 | $var = $n; |
|
| 2415 | } else { |
|
| 2416 | $var = self::encode('UTF-8', $var); |
|
| 2417 | } |
|
| 2418 | ||
| 2419 | } |
|
| 2420 | if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) { |
|
| 2421 | // Prevent leading combining chars |
|
| 2422 | // for NFC-safe concatenations. |
|
| 2423 | $var = $leading_combining . $var; |
|
| 2424 | } |
|
| 2425 | } |
|
| 2426 | break; |
|
| 2427 | } |
|
| 2428 | ||