10
$\begingroup$

Bug introduced in 10.0 and fixed in 10.0.2


I tried to import file in Mathematica 10 ( windows 7 system), the path contains some chinese characters. After holding ctrl+shift, and drag the file into front end. I got path like

c:\\Users\\m&p\\Desktop\\桌面\\test.txt

But after running

Import["c:\\Users\\m&p\\Desktop\\\:684c\:9762\\test.txt"]

Mathematica 10 gives error message as follows:

Import::nffil: File not found during Import.

What should I do to make mathematica 10 support path containing Chinese characters?

$\endgroup$
11
  • 1
    $\begingroup$ What kind of computer are you using: Macintosh, Raspberry Pi, Linux, or Windows? $\endgroup$
    – librik
    Commented Jul 17, 2014 at 2:41
  • 1
    $\begingroup$ Works fine on OS X. This is expected to be OS-dependent. Are you on Windows? What language version of Windows? There's also a setting in Windows (which I don't know where it is anymore, as I don't have a Windows computer here) that will adjust the character set for software that doesn't support Unicode. If you like to use Chinese path names, it's worth setting that to Chinese. Otherwise non-Unicode-aware Windows programs won't see those paths. $\endgroup$
    – Szabolcs
    Commented Jul 17, 2014 at 2:48
  • 2
    $\begingroup$ Possibly related: "Bug in handling backslashed Cyrillic symbols in v.10.0.0?" $\endgroup$ Commented Jul 17, 2014 at 4:26
  • 1
    $\begingroup$ I can reproduce this under win8.1, and the slash (/) workaround in the Q/A linked by @AlexeyPopkov works fine. $\endgroup$
    – Silvia
    Commented Jul 17, 2014 at 19:04
  • 1
    $\begingroup$ @AlexeyPopkov Yes, I confirm that if I put a special character after `\`, I also got strange character code under Linux. $\endgroup$
    – Yi Wang
    Commented Jul 18, 2014 at 6:39

1 Answer 1

11
$\begingroup$

In Mathematica 10.0.0 for Windows, I have experienced similar problems.
When non-ASCII characters were placed after \ in a string, they were decoded in a strange way. (Character '\' is used as a path separator in Windows).

ToCharacterCode["\\a", "Unicode"](*OK*)
{92, 97}

ToCharacterCode["\\", "Unicode"](*OK*)
{92}

ToCharacterCode["μ", "Unicode"](*OK*)
{956}

ToCharacterCode["\\μ", "Unicode"](*Strange!*)
{92, 92, 58, 48, 51, 98, 99}

"μ" in this expample can be some Chinese/Japanese characters. It makes a severe problem because this sometimes happens in file path such as "C:\MyData\μ-channel\" in Windows. You could avoid this problem by using "c:/MyData/μ-channel/".

$\endgroup$
5
  • $\begingroup$ Have you already reported this to Wolfram support? $\endgroup$
    – Szabolcs
    Commented Jul 17, 2014 at 14:37
  • 3
    $\begingroup$ Yes. I have reported the problem at 7/14 ([CASE:1213192]). But no responses yet. $\endgroup$ Commented Jul 17, 2014 at 15:02
  • 3
    $\begingroup$ (Updated) I received a reply today from Wolfram research: "... I am able to reproduce the issue you found and will file a report on it. ...". $\endgroup$ Commented Jul 17, 2014 at 23:58
  • $\begingroup$ @TetsuoIchii So this is a bug? $\endgroup$
    – matheorem
    Commented Jul 18, 2014 at 14:47
  • $\begingroup$ Yes. I think it is a bug. Please try "c:/Users/m&p/Desktop/桌面/test.txt" to circumvent the problem. $\endgroup$ Commented Jul 19, 2014 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.