(Cross-posted on the Wolfram Community, reported to the support as [CASE:3965891].)
The Mathematica's Kernel and FrontEnd currently work well with Unicode file/directory paths, but some other components of the system contain long-standing bugs which are source of troubles for the users, especially for the users from non-English-speaking countries.
The most recent version of Mathematica 12.1 still fails to Import a PDF file when its path contains non-ASCII characters: under Windows Import returns $Failed, under OSX it returns empty list. This is due to a long-standing bug in the component "PDF.exe" which is responsible for importing of PDF files:
Export["Тест.pdf", ""]
Import[%]
"Тест.pdf" $Failed
The same is true for Importing Mathematica's native NB files as "Plaintext" due to a similar long-standing bug in "NBImport.exe":
Export["Тест.nb", ""]
Import[%, {"NB", "Plaintext"}]
"Тест.nb" $Failed
The new in version 11 HTTPRequest/URLRead functionality also suffer from this bug. Here is an attempt to upload an image with non-ASCII filename to imgur.com using the method from this answer:
Export["Тест.png", Plot[Sin[x], {x, 0, Pi}]]
URLRead[HTTPRequest[
"http://stackoverflow.com/upload/image", <|
"Body" -> {"image" -> <|"Content" -> File[%], "MIMEType" -> "image/png"|>}|>]]
And undoubtedly there are other components suffering from this bug because reports about problems with Unicode filepaths keep appearing on this site.
Hence it is worth to have a dedicated thread with a collection of general techniques allowing to workaround such problems. This thread is intended exactly for this purpose. Some guidelines:
- When posting an OS-specific workaround, please include information about OS.
- If a workaround is limited to local file paths and doesn't work for network paths, please mention this.
- Each answer should contain elaborated description of only one general method along with its limitations.
Related questions:
- Cannot import Excel (xls or xlsx) files which have non-ASCII characters in the name
- 11.3 - import of files with paths containing non-ASCII characters
- How to deal with Chinese Windows path/filename?
- Can't get Mathematica to Import PDF files with diacritics on the file name
- Mathematica 10 doesn't support path containing Chinese characters
- Bug in handling backslashed Cyrillic symbols in v.10.0.0?
- Problem with my user name
- Wrong function of NotebookDirectory[] in the 12.1 version



Import["~/Тест.pdf"]) gives the warningImport::general: Could not find the start of the cross reference tableand returns an empty list{}. Renaming file totest.pdffixes the problem. – Ray Shadow Apr 19 '17 at 14:14$TemporaryDirectory, have non-ASCII characters. The root cause seems to be thatRunProcessfails if the current directory has non-ASCII characters in its path. But I cannot reproduce this problem. Can you? E.g. tryRunProcess["C:\\windows\\System32\\where.exe", ProcessDirectory -> $TemporaryDirectory](or substitute a path with non-ASCII chars for$TemporaryDirectoryif your username is all-ASCII). – Szabolcs Nov 18 '17 at 16:59$TemporaryDirectorybut the commandRunProcess["C:\\windows\\System32\\where.exe", ProcessDirectory -> $TemporaryDirectory]returns<|"ExitCode" -> 2, ...|>(what means an error), I do not know why. – Alexey Popkov Nov 18 '17 at 20:15SystemOpenseems to be broken for paths involving non-ASCII characters in v12, the short path trick doesn't seem to work. – xzczd Jun 06 '19 at 07:11SystemOpenis broken in v12.0.0 but the short path trick works for me, trySystemOpen[FileInformation[path, "AbsoluteShortFileName"]]. – Alexey Popkov Jul 01 '19 at 05:56Export["测试.txt", "aaaaaa"]; FileInformation["测试.txt", "AbsoluteShortFileName"]gives"C:\\Users\\PC\\DOCUME~1\\测试.txt", andshortPath["测试.txt"]gives"C:\\Users\\PC\\DOCUME~1\\\.b2âÊÔ.txt"– xzczd Jul 01 '19 at 06:40SystemOpencorrectly opens exported file via short path). I recommend reporting this to the support. – Alexey Popkov Jul 01 '19 at 07:46Information[File@"测试.txt", "AbsoluteShortFileName"]. – Alexey Popkov Jul 01 '19 at 09:46"C:\\Users\\PC\\DOCUME~1\\测试.txt"is exactly the correct short filename in Windows Chinese edition i.e. non-ASCII characters can be used in the short filename at least in Windows Chinese edition. (BTW if the filename is changed to e.g."测试测试测试测试.txt"the output will be"C:\\Users\\PC\\DOCUME~1\\测试测~1.TXT. ) – xzczd Jul 01 '19 at 11:02