| @@ 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 | } |
|
| @@ 2342-2360 (lines=19) @@ | ||
| 2339 | // Workaround https://bugs.php.net/65732 |
|
| 2340 | $var = str_replace(array("\r\n", "\r"), "\n", $var); |
|
| 2341 | } |
|
| 2342 | if (preg_match('/[\x80-\xFF]/', $var)) { |
|
| 2343 | if (Normalizer::isNormalized($var, $normalization_form)) { |
|
| 2344 | $n = '-'; |
|
| 2345 | } else { |
|
| 2346 | $n = Normalizer::normalize($var, $normalization_form); |
|
| 2347 | ||
| 2348 | if (isset($n[0])) { |
|
| 2349 | $var = $n; |
|
| 2350 | } else { |
|
| 2351 | $var = self::encode('UTF-8', $var); |
|
| 2352 | } |
|
| 2353 | ||
| 2354 | } |
|
| 2355 | if ($var[0] >= "\x80" && isset($n[0], $leading_combining[0]) && preg_match('/^\p{Mn}/u', $var)) { |
|
| 2356 | // Prevent leading combining chars |
|
| 2357 | // for NFC-safe concatenations. |
|
| 2358 | $var = $leading_combining . $var; |
|
| 2359 | } |
|
| 2360 | } |
|
| 2361 | break; |
|
| 2362 | } |
|
| 2363 | ||