(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.0 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 Import
ing 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:
Comments
Post a Comment