I am trying to use Unicode input to wolframscript -c, like so:

$ ./wolframscript -c '1/∞'

The source of this behavior seems to be that wolframscript is failing to recognize multibyte characters and is instead interpreting the infinity symbol as its UTF-8 bytes (â is byte 226, and the others appear to be ignored).

$ ./wolframscript -c 'ToCharacterCode@"∞"'
{226, 136, 158}

Interestingly, it does seem to be able to handle UTF-8 from a file when called with -script, but not with -f:

$ echo '1/∞ // Print' > test
$ ./wolframscript -f test
$ ./wolframscript -script test

Writing to a file and calling wolframscript -script on it is a solution, but I'd prefer to be able to specify the code as an argument.

wolframscript -h describes a -charset CHARSET argument that "Sets character output format," but I cannot seem to find an equivalent option for input encoding. The issue is present with both urxvt and uxterm on Arch Linux. My locale is en_US.UTF-8, but setting LC_ALL=C doesn't seem to change anything.

How can I make wolframscript recognize UTF-8 characters in code given as a command line argument?

  • 1
    $\begingroup$ I would report this to support@wolfram.com $\endgroup$ – chuy May 29 '18 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.