Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why am I getting the error

Syntax::sntunc: Unicode longname in the string is unterminated.

from the following?

astroSymbol[name_String] := ToString[ToExpression["\[" <> name <> "]"]] <> "" ;

Is there something I need to do to wrap the escape sequence to avoid this error?

share|improve this question
You have to escape the slash: "\\[" – Leonid Shifrin Nov 14 '12 at 15:15
That's the answer. I'm surprised it works at all without the escape (it generates the expected string). – raxacoricofallapatorius Nov 14 '12 at 15:18
You can write an answer to your own question, now. :) – J. M. Nov 14 '12 at 16:07
up vote 3 down vote accepted

To include a backslash in a string, you need to escape it, like so:

"\\[" <> name <> "]"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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