-
Notifications
You must be signed in to change notification settings - Fork 5k
CJK Extension B characters cannot be used in Content-Disposition FileNameStar #28145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Caesar1995 you looked into encoding bug in HTTP headers recently. Can you please check this one too? |
Yes I can take a look. |
RFC 6266 Appendix D:
From screen shot, seems |
@Caesar1995 , Also from RFC 6266 Appendix D:
Since Chrome is apparently smart enough to decode |
cc: @rmkerr since you had fun with unicode recently. |
The bug is in the encoding function linked in the original post: The foreach loop on line 86 does not consider that individual Unicode scalars may be composed of surrogate pairs. It tries to get the UTF-8 encoding of the high and low surrogates separately. Since surrogates are invalid on their own, they get replaced with �. We should rework this loop to handle surrogate pairs correctly. |
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process. This process is part of our issue cleanup automation. |
This seems to be long time fixed by dotnet/corefx#36627 |
A file name with CJK Extension B characters, such as 𠀀𠀁𠀂𠀃𪛑𪛒𪛓𪛔𪛕𪛖.txt, is not properly encoded for the FileNameStar property of the Content-Disposition header. These characters are replaced with \uFFFD, such as ��������������.txt.
Using the code below:
We can observe while debugging in Visual Studio:

This causes the file download in the browser to be named as ��������������.txt.
The encoding appears to be done in HeaderUtilities.IsInputEncoded5987(). Can anything be done to support these characters?
Thanks - Jay
The text was updated successfully, but these errors were encountered: