I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

This is possibly caused by not all packets are read off properly

I will show the Mathematica code bellowd that you could test easily.

I'm using EnterTextPacket function(which communicates through WSTP) to talk with KernelLink. You could find refercence here

The first case evaluates 10!, and works well

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link](*the last package*)

works well

we could see the last LinkRead[link] returned In[2]:= indicates all packages read off.

The next case evaluates \[BadEscape] causes packages returned with endless. LinkRead[link] returned Syntax Err continuously.

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]

enter image description here enter image description here

So I think this must be the problem. Does this make sense ?

  • $\begingroup$ Do you mean J/Link? Can you give a specific example that causes the kernel to hang? It shouldn't hang. Maybe you are just not reading off all the packets (error messages) from the link ... $\endgroup$
    – Szabolcs
    Jan 18, 2016 at 9:09
  • $\begingroup$ Possible duplicate of List of Mathematica glyphs $\endgroup$
    – Edmund
    Jan 18, 2016 at 10:37
  • $\begingroup$ The reason why I wouldn't mark it as duplicate is that very likely the cause of the problem is not the invalid named character. Instead the link might be blocking because not all packets are read off properly. Thus the solution is not to filter these named characters. $\endgroup$
    – Szabolcs
    Jan 18, 2016 at 11:13
  • $\begingroup$ @Szabolcs thanks for reply. Yes, it's J/Link, called by java. I will give you the specified code tommorow since I am out off office. $\endgroup$
    – Michael
    Jan 18, 2016 at 13:11
  • 1
    $\begingroup$ @Szabolcs Just let you known, Wolfram has confirmed this's a native defect. I just got the feedback email. This will be fixed in next release. $\endgroup$
    – Michael
    Jul 19, 2016 at 2:58

1 Answer 1


The help documentation has a section called Listing of Named Characters. One way to get to it is to hit the F1 key and then paste the following into the documentation window:


To generate a list programmatically, code

codes = Table[ToString[
    CharacterEncoding -> "PrintableASCII"],
   {u, 0, 65535}];
lnames = Flatten@StringCases[codes, "\\[" ~~ __ ~~ "]" ];

In MMA 10.3, that should generate a list of 1005 long names. It may or may not match the named character list in the documentation.


Your Answer

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

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