Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

a way to escape strings for export

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66050] a way to escape strings for export
  • From: "Chris Chiasson" <chris.chiasson at gmail.com>
  • Date: Thu, 27 Apr 2006 05:45:14 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

(the first line is needed, because it trips something inside
Mathematica that defines the generateNumericEntityFromCharacterCode
function)

this is useful for XML, XHTML, etc export

In[1]:=
XML`MathML`BoxesToMathML["\[Beta]"];
In[2]:=
escapeStringXML[strxpr_String]:=
  Apply[StringJoin,

If[Or[33\[LessEqual]#\[LessEqual]127,#\[Equal]10],FromCharacterCode[#],

System`Convert`XMLDump`generateNumericEntityFromCharacterCode@#]&/@
      ToCharacterCode[strxpr]]
In[3]:=
escapeStringXML["\[Beta]\[Alpha]+1-2g\[Zeta]"]
Out[3]=
&#946;&#945;+1-2g&#950;


  • Prev by Date: Re: ParametricPlot3D of the Mesh
  • Next by Date: Re: Selecting table rows
  • Previous by thread: Re: Issue
  • Next by thread: Image Processing