# How do I construct a “named character” programmatically?

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?

-
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. :) –  Guess who it is. Nov 14 '12 at 16:07

"\\[" <> name <> "]"