# Converting Mathematica Greek letters from Notebook to Unicode Form in SE

Related :

How to "Copy as Unicode" from a Notebook?

Plot[\[Alpha], {\[Alpha], 0, 8}]

cellExpression

(*
Cell[BoxData[RowBox[{Plot,[,RowBox[{\[Alpha],,,RowBox[{{,RowBox[{\[Alpha],,,0,,,8}],}}]}],
]}]],Input,CellChangeTimes->{3.58068*10^9,{3.58068*10^9,3.58068*10^9}}]
*)

CellExpression2InputText[cellExpression_] := First[FrontEndExecute[
FrontEndExportPacket[cellExpression, "InputText"]]]

CellExpression2InputText[cellExpression]

(*
Plot[\[Alpha], {\[Alpha], 0, 8}]
*)

CellExpression2InputText[cellExpression] // CopyToClipboard

Paste[]

Plot[\[Alpha], {\[Alpha], 0, 8}]


when copy the result above to SE, the [Alpha] was not shown in Unicode Form. And I failed in my usage involved with CellExpression2InputText

Mr.Wizard's method, this is good to copy directly from input cell.

SetAttributes[copyUnicode, HoldFirst]
copyUnicode[expr_, form_: InputForm] :=
Run["clip <", Export["\$Clipboard.temp", ToString[Unevaluated @ expr, form],
"Text", CharacterEncoding -> "Unicode"]];


### case 1

CellExpression2InputText[cellExpression] // copyUnicode

Paste[]


PasteResult（not good）

CellExpression2InputText[cellExpression]


### case 2

ToExpression[CellExpression2InputText[cellExpression], InputForm, HoldForm] // copyUnicode

Paste[]


still not good

## question

So question is clear:

How to convert CellExpression to string/clipboard with greek letters in Unicode Form when copy to SE without laborious work by hand.

\[Alpha] ==> to α

-
I thought you understood after the discussion in meta that you shouldn't use combine quote form and comment form to format an output cell in markdown. Evidently, I was wrong, so I tell you now: don't do it. –  m_goldberg Jun 20 '13 at 3:52
@m_goldberg aha, fine, ok, I will modify my package to generate that differ from the old styles. –  HyperGroups Jun 20 '13 at 4:03
@m_goldberg help, When I'm reading the MarkDown help page, I have trouble comprehending this sentence.Like code blocks, code spans will be displayed in a monospaced font. Markdown and HTML will not work within them. Note that, [unlike] code blocks, code spans require you to manually escape any HTML within! I donot know what is the unlike mean. Because I found that they both keep the html tags. –  HyperGroups Jun 20 '13 at 7:52
I don't think this comment thread is the place to discuss this. Post it as a question in meta, or take it up in chat. –  m_goldberg Jun 20 '13 at 9:45
@m_goldberg ok, seems a little tiny as a question in meta. I haven't used chat by far, maybe I should try that. –  HyperGroups Jun 20 '13 at 10:02

For this specific case there is a solution which does not rely on Mathematica. Since the greek characters copied from Mathematica were a general problem here on our site which made code-blocks tedious to read, I have adapted a stolen user script. This can be installed as extension into browsers and provides additional buttons which let you (beside other things) make this conversion easily.

Although I'm not on Windows and you apparently are, I would guess that you can fix this problem by wrapping your cellExpression as follows:
ToExpression[cellExpression, InputForm, HoldForm]

The output of your function CellExpression2InputText escapes the backslashes defining Mathematica's special characters, so they aren't translated to Unicode. But this added escape level is removed in ToExpression`.