File names containing international characters other than ascii

Does anyone have any experience creating files containing file names containing non-lingual language characters other than ascii?

Does it make it easy, or is it fraught with danger?

Is this functionality expected from users from Japanese / Chinese?

Should file extensions also appear in international languages?

Info: We currently support multilingualism on our site, but our file names are always ASCII. We use ASP.NET for the .NET platform. This will be used in a scenario where international users can choose a common format and name for the files.

+3
source share
5 answers

Is this functionality expected from users from Japanese / Chinese?

Yes.

Is it easy to do, or is it fraught with danger?

There is a problem. If you serve files directly or otherwise have the file name in the URL (for example: http://www.example.com/files/ こ γ‚“ に け は .txt β†’ http://www.example.com/files/ % E3% 81% 93% E3% 82% 93% E3% 81% AB% E3% 81% A1% E3% 81% AF.txt), you are generally fine.

But if you submit files with the file name generated by the script, you may have problems. The problem is with the header:

Content-Disposition: attachment;filename="こんにけは.txt"

? , UTF-8. . IE, HTTP. Windows cp1252 (Latin-1) cp932 (Shift-JIS) - , UTF-8, , .

: ? , . HTTP RFC2616 , HTTP - ISO-8859-1, . , -1 RFC2047, RFC2047 , . RFC822 RFC2231 Unicode Content-Disposition (RFC2183), RFC2616 RFC2183 . HTTP RFC822, 822. , - , , , , , . , " " _ = "..." , .

, -ASCII- , , "filename" , , URL-.

?

, .

Windows , - , ASCII.

, : , , -ASCII . , , , (Han ..) .

, , , "42" ".txt" . , "Unicode Normal Form NFKC", - .

+6

.

, , .

+1

. .

, , , . , .

+1

Unicode . :

. : Unicode (UTF-8/16/32) , Unicode /, .

, -, , , , / , .

i18-ned.

0

:

  • , URL-, bobince: www.example.com/files/%E3%81%93%E3%82%93%E3.txt

  • I had to create a special routine for IE7, as it truncates the file name if it is longer than 30 characters. Therefore, instead of the file "Your very long file name.txt" will appear as "% d4y long file name.txt". Interestingly, IE7 really understands the nesting of the header: filename =% E3% 81% 93% E3% 82% 93% E3.txt correctly.

0
source

Source: https://habr.com/ru/post/1703860/


All Articles