Skip to content

Commit

Permalink
Switch from iconv to mb_convert_encoding
Browse files Browse the repository at this point in the history
Fixes nextcloud#1966

Signed-off-by: Kees van Kempen <[email protected]>
  • Loading branch information
Keessaus committed Jan 7, 2022
1 parent 3e4ef0f commit 6b5dea9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public function putFile($fileId,
}
$file = $file[0];
$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
$suggested = iconv('utf-7', 'utf-8', $suggested);
$suggested = mb_convert_encoding($suggested, 'utf-8', 'utf-7');

if ($suggested[0] === '.') {
$path = dirname($file->getPath()) . '/New File' . $suggested;
Expand Down Expand Up @@ -575,7 +575,7 @@ public function putRelativeFile($fileId,

$suggested = $this->request->getHeader('X-WOPI-RequestedName');

$suggested = iconv('utf-7', 'utf-8', $suggested) . '.' . $file->getExtension();
$suggested = mb_convert_encoding($suggested, 'utf-8', 'utf-7') . '.' . $file->getExtension();

if (strpos($suggested, '.') === 0) {
$path = dirname($file->getPath()) . '/New File' . $suggested;
Expand Down Expand Up @@ -610,7 +610,7 @@ public function putRelativeFile($fileId,
$file = $file[0];

$suggested = $this->request->getHeader('X-WOPI-SuggestedTarget');
$suggested = iconv('utf-7', 'utf-8', $suggested);
$suggested = mb_convert_encoding($suggested, 'utf-8', 'utf-7');

if ($suggested[0] === '.') {
$path = dirname($file->getPath()) . '/New File' . $suggested;
Expand Down

0 comments on commit 6b5dea9

Please sign in to comment.