8000 minor #46132 Use mb_convert_encoding instead of utf8_decode (fancyweb) · symfony/symfony@fd1c94b · GitHub
[go: up one dir, main page]

Skip to content

Commit fd1c94b

Browse files
minor #46132 Use mb_convert_encoding instead of utf8_decode (fancyweb)
This PR was merged into the 4.4 branch. Discussion ---------- Use mb_convert_encoding instead of utf8_decode | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Related to https://wiki.php.net/rfc/remove_utf8_decode_and_utf8_encode. Those are the only occurrences in the whole code 😃 Commits ------- 9d0054d Use mb_convert_encoding instead of utf8_decode
2 parents 5116846 + 9d0054d commit fd1c94b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Symfony/Component/HttpFoundation/Tests/BinaryFileResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function testSetContentDispositionGeneratesSafeFallbackFilenameForWrongly
7171
{
7272
$response = new BinaryFileResponse(__FILE__);
7373

74-
$iso88591EncodedFilename = utf8_decode('föö.html');
74+
$iso88591EncodedFilename = mb_convert_encoding('föö.html', 'ISO-8859-1', 'UTF-8');
7575
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $iso88591EncodedFilename);
7676

7777
// the parameter filename* is invalid in this case (rawurldecode('f%F6%F6') does not provide a UTF-8 string but an ISO-8859-1 encoded one)

src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ public function testEncoding()
8888
$loader = new XliffFileLoader();
8989
$catalogue = $loader->load(__DIR__.'/../fixtures/encoding.xlf', 'en', 'domain1');
9090

91-
$this->assertEquals(utf8_decode('föö'), $catalogue->get('bar', 'domain1'));
92-
$this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1'));
91+
$this->assertEquals(mb_convert_encoding('föö', 'ISO-8859-1', 'UTF-8'), $catalogue->get('bar', 'domain1'));
92+
$this->assertEquals(mb_convert_encoding('bär', 'ISO-8859-1', 'UTF-8'), $catalogue->get('foo', 'domain1'));
9393
$this->assertEquals(
9494
[
9595
'source' => 'foo',
96-
'notes' => [['content' => utf8_decode('bäz')]],
96+
'notes' => [['content' => mb_convert_encoding('bäz', 'ISO-8859-1', 'UTF-8')]],
9797
'id' => '1',
9898
'file' => [
9999
'original' => 'file.ext',

0 commit comments

Comments
 (0)
0