sabredav replace utf8_encode
This commit is contained in:
parent
db1d099341
commit
be0a2c84bf
3 changed files with 6 additions and 13 deletions
|
@ -81,7 +81,7 @@ class StringUtil {
|
|||
$encoding = mb_detect_encoding($input, ['UTF-8', 'ISO-8859-1'], true);
|
||||
|
||||
if ($encoding === 'ISO-8859-1') {
|
||||
return utf8_encode($input);
|
||||
return mb_convert_encoding($input, 'UTF-8', 'ISO-8859-1');
|
||||
} else {
|
||||
return $input;
|
||||
}
|
||||
|
|
|
@ -431,13 +431,8 @@ function decodePath($path) {
|
|||
function decodePathSegment($path) {
|
||||
|
||||
$path = rawurldecode($path);
|
||||
$encoding = mb_detect_encoding($path, ['UTF-8', 'ISO-8859-1']);
|
||||
|
||||
switch ($encoding) {
|
||||
|
||||
case 'ISO-8859-1' :
|
||||
$path = utf8_encode($path);
|
||||
|
||||
if (!mb_check_encoding($path, 'UTF-8') && mb_check_encoding($path, 'ISO-8859-1')) {
|
||||
$path = mb_convert_encoding($path, 'UTF-8', 'ISO-8859-1');
|
||||
}
|
||||
|
||||
return $path;
|
||||
|
|
|
@ -43,14 +43,12 @@ class StringUtil {
|
|||
|
||||
switch($encoding) {
|
||||
case 'ISO-8859-1' :
|
||||
$newStr = utf8_encode($str);
|
||||
//$newStr = utf8_encode($str);
|
||||
$newStr = mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1');
|
||||
break;
|
||||
/* Unreachable code. Not sure yet how we can improve this
|
||||
* situation.
|
||||
case 'WINDOWS-1252' :
|
||||
$newStr = iconv('cp1252', 'UTF-8', $str);
|
||||
$newStr = mb_convert_encoding($str, 'UTF-8', 'WINDOWS-1252');
|
||||
break;
|
||||
*/
|
||||
default :
|
||||
$newStr = $str;
|
||||
|
||||
|
|
Loading…
Reference in a new issue