Fix SupportFileDownloads - Multibyte character support #6553
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1️⃣ Is this something that is wanted/needed? Did you create a discussion about it first?
Yes
#4946
This is not a discussion I created, but another person put it up.
2️⃣ Did you create a branch for your fix/feature? (Master branch PR's will be closed)
Yes
3️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out.
No
4️⃣ Does it include tests? (Required)
Yes
5️⃣ Please include a thorough description (including small code snippets if possible) of the improvement and reasons why it's useful.
I added the above code to
livewire/src/Features/SupportFileDownloads.php
above. Currently, there was a problem that file names containing Japanese characters would end up as______.csv
when trying to download them. We believe this needs to be fixed, especially since Livewire is a very popular library in Japan.We have improved the problem by adding a decoding process in the case of filename*, and confirmed that it works with UnitTest.
I have tested this modification on Laravel in the following environment
PHP 8.2.9
Laravel 10.22.0
#4946
I tested with
Ελληνικά.xlsx
and Japaneseダウンロード.csv
in the same situation asBefore the modification, as shown below,
________.xlsx
and______.csv
with multibyte characters did not download with the correct file name.With this correction, we can confirm that we were able to download the file with the correct file name.
Below is a screenshot of the corrected file.