This is a migrated thread and some comments may be shown as answers.

RadEditor displays MathML code in Design mode

1 Answer 82 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Amy
Top achievements
Rank 1
Amy asked on 03 Aug 2010, 09:09 PM
I'm experiencing an issue with the RadEditor displaying MathML code in Design mode rather than the corresponding symbol.  This only happens when the MathML code includes attributes such as font family or table alignment.  At first the MathML code was being truncated when encountering single quotes used in the attributes.  So I added a line of code to perform string replace() method replacing single quotes with the corresponding URL encoding of %60.  Ultimately the string gets created into an image which is displayed in Design mode of the RadEditor.  As a side note, the website uses the MathFlow applet from DesignScience.

Here's the HTML code for a solid triangle, which displays the symbol correctly in Design mode:
<img alt="%3Cmath%3E%3Cmrow%3E%3Cmo%3E%26utrif;%3C/mo%3E%3C/mrow%3E%3C/math%3E" src="/TestDevelopment/displayMathML.aspx?MathML=%3Cmath%3E%3Cmrow%3E%3Cmo%3E%26utrif;%3C/mo%3E%3C/mrow%3E%3C/math%3E" title="%3Cmath%3E%3Cmrow%3E%3Cmo%3E%26utrif;%3C/mo%3E%3C/mrow%3E%3C/math%3E" />

Here's the HTML code for a triangle, which does not display the symbol in Design mode, but rather the value of the 'alt' attribute:
<img alt="%3Cmath%3E%3Cmrow%3E%3Cmo%20fontfamily%3D%60MS%20Mincho%60%3E%26xutri;%3C/mo%3E%3C/mrow%3E%3C/math%3E" src="/TestDevelopment/displayMathML.aspx?MathML=%3Cmath%3E%3Cmrow%3E%3Cmo%20fontfamily%3D%60MS%20Mincho%60%3E%26xutri;%3C/mo%3E%3C/mrow%3E%3C/math%3E" title="%3Cmath%3E%3Cmrow%3E%3Cmo%20fontfamily%3D%60MS%20Mincho%60%3E%26xutri;%3C/mo%3E%3C/mrow%3E%3C/math%3E" />

If I remove the fontfamily attribute from 'src' in the line of code above then the triangle symbol will display correctly in Design mode.

So I'm guessing there is something wrong with the way the URL is formed, just not sure what. ;-)  The MathFlow API has a method which returns a string containing URL-encoded packed MathML markup for the current equation, which includes escaping some of the characters such as the angle brackets, ampersand, etc., however the method does not handle escaping single quotes.

Any thoughts or ideas about how to get this working properly would be greatly appreciated!!!

1 Answer, 1 is accepted

Sort by
0
Amy
Top achievements
Rank 1
answered on 04 Aug 2010, 07:04 PM
Turns out I was using the wrong URL-encoding.  %60 is for an apostrophe, and %27 is for the single quote.  Yay!!
Tags
Editor
Asked by
Amy
Top achievements
Rank 1
Answers by
Amy
Top achievements
Rank 1
Share this question
or