(Cross-posted from Mathematica.SE)
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 11.2.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", Plot[Sin[x], {x, 0, Pi}]]
Import["????.pdf"]
"????.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", Plot[Sin[x], {x, 0, Pi}]]
Import["????.nb", {"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["????.png"], "MIMEType" -> "image/png"|>}|>]]
And undoubtedly there are other components suffering from this bug because reports about problems with Unicode filepaths keep appearing on Mathematica.SE:
- Cannot import Excel (xls or xlsx) files which have non-ASCII characters in the name
- 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?
In the original dedicated Mathematica.SE thread two workarounds are given, each of which has its own set of limitations/drawbacks. Are there some other, potentially better ways to avoid failures with Unicode file/directory paths?
Reported to the support as [CASE:3965891].
[1]: https://mathematica.stackexchange.com/q/143953/280
[2]: https://mathematica.stackexchange.com/questions/143953/how-to-workaround-failures-with-unicode-filepaths#comment387154_143953
[3]: http://imgur.com
[4]: https://mathematica.stackexchange.com/a/141853/280
[5]: https://i.stack.imgur.com/wPkUF.png
[6]: https://i.stack.imgur.com/wPkUF.png
[7]: https://mathematica.stackexchange.com/
[8]: https://mathematica.stackexchange.com/q/143953/280
