| @@ 180-197 (lines=18) @@ | ||
| 177 | $s = str_replace(array("\r\n", "\r"), "\n", $s); |
|
| 178 | } |
|
| 179 | ||
| 180 | if (preg_match('/[\x80-\xFF]/', $s)) { |
|
| 181 | if (Normalizer::isNormalized($s, $normalization_form)) { |
|
| 182 | $n = '-'; |
|
| 183 | } else { |
|
| 184 | $n = Normalizer::normalize($s, $normalization_form); |
|
| 185 | if (isset($n[0])) { |
|
| 186 | $s = $n; |
|
| 187 | } else { |
|
| 188 | $s = UTF8::encode('UTF-8', $s); |
|
| 189 | } |
|
| 190 | } |
|
| 191 | ||
| 192 | if ($s[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $s)) { |
|
| 193 | // Prevent leading combining chars |
|
| 194 | // for NFC-safe concatenations. |
|
| 195 | $s = $leading_combining . $s; |
|
| 196 | } |
|
| 197 | } |
|
| 198 | ||
| 199 | return $s; |
|
| 200 | } |
|
| @@ 2578-2596 (lines=19) @@ | ||
| 2575 | // Workaround https://bugs.php.net/65732 |
|
| 2576 | $var = str_replace(array("\r\n", "\r"), "\n", $var); |
|
| 2577 | } |
|
| 2578 | if (preg_match('/[\x80-\xFF]/', $var)) { |
|
| 2579 | if (Normalizer::isNormalized($var, $normalization_form)) { |
|
| 2580 | $n = '-'; |
|
| 2581 | } else { |
|
| 2582 | $n = Normalizer::normalize($var, $normalization_form); |
|
| 2583 | ||
| 2584 | if (isset($n[0])) { |
|
| 2585 | $var = $n; |
|
| 2586 | } else { |
|
| 2587 | $var = self::encode('UTF-8', $var); |
|
| 2588 | } |
|
| 2589 | ||
| 2590 | } |
|
| 2591 | if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) { |
|
| 2592 | // Prevent leading combining chars |
|
| 2593 | // for NFC-safe concatenations. |
|
| 2594 | $var = $leading_combining . $var; |
|
| 2595 | } |
|
| 2596 | } |
|
| 2597 | break; |
|
| 2598 | } |
|
| 2599 | ||