Skip to content
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

nonascii characters in filename doesn't work in Unity #18

Open
choigawoon opened this issue Dec 31, 2023 · 3 comments
Open

nonascii characters in filename doesn't work in Unity #18

choigawoon opened this issue Dec 31, 2023 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@choigawoon
Copy link

In .Net 8.0, works perfectly. but not in Unity.

here's my reproduction sample.
https://github.com/choigawoon/test-unity-synology-api

open Assets/Scens/TestScene and click play after inserting infos.
image


Something`s broken when doing this code.

headerValue = bytes.Aggregate("", (current, b) => current + (char) b);

In .Net 8.0

headerValue:
"form-data; name="file"; filename="ìµ\u009cê°\u0080ì\u009a´_H2_RIGHT_STAGE 2 - 2_20231220_234457_640x360.mp4"; filename*=UTF-8''%EC%B5%9C%EA%B0%80%EC%9A%B4_H2_RIGHT_STAGE%202%20-%202_20231220_234457_640x360.mp4"

In Unity

headerValue:
"form-data; name="file"; filename="���_H2_RIGHT_STAGE 2 - 2_20231220_234457_640x360.mp4"; filename*=UTF-8''%EC%B5%9C%EA%B0%80%EC%9A%B4_H2_RIGHT_STAGE%202%20-%202_20231220_234457_640x360.mp4"

@choigawoon
Copy link
Author

In Net8.0
(char)b convert to unicode when b is 156,

"form-data; name="file"; filename="ìµ\u009c"
(char)b = 156 '\u009c' |char|

In unity,
"form-data; name="file"; filename="�"
(char)b = '�' |char|

i have no idea from here. how to fix it?

@plneto
Copy link
Owner

plneto commented Jan 2, 2024

I'm not familiar with Unity. Is it possible to reproduce the issue using a regular .NET project?

One thing you could try is to download this project and reference it directly in your Unity project. That way it will be easier to debug the code and fix the errors. It would be great if you could try it.

@choigawoon
Copy link
Author

choigawoon commented Jan 3, 2024

it works in regular .NET project as i mentioned. ( .NET 8.0 )
i would have to ask to unity community about this.

@plneto plneto added the help wanted Extra attention is needed label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants