GenoPro Home
GenoPro Home  |  Get Started With My Genealogy Tree  |  Buy  |  Login  |  Privacy  |  Search  |  Site Map
 

GenoPro Support Forum




Util.FormatPhrase() does not encode special HTML characters

Click to view RSS...
Author The GenoPro SDK states that WritePhrase() and Report.Write(Util.FormatPhrase()) are equivalent.
Posted Wednesday, May 11, 2011 - Post #28343
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Customers
Important Contributors
FamilyTrees.GenoPro.com
GenoPro version: 3.1.0.1

Last Login: 2 days ago @ 9:23 PM
Posts: 3,464, Visits: 26,854
Whilst investigating a reported issue in the Narrative Report I found what appears to be a bug in the Report Generator's Util.FormatPhrase method. 

The GenoPro SDK states that WritePhrase() and Report.Write(Util.FormatPhrase()) are equivalent.

However it appears that the two methods differ in that Util.FormatPhrase appears not to encode special characters as per Util.HtmlEncode. I have attached files for a simple skin to demonstrate this.

<html><head><title>Tester</title></head><body>
<h1>Test to check Util.FormatPhrase versus Report.WritePhrase</h1>
<%[
Report.Write(Util.FormatPhrase("{0}", "This line was produced by Report.Write Util.FormatPhrase(...) and contains the following characters that should be html encoded > < & "));
Report.WriteLn(Report.TagBr);
Report.WritePhrase("{0}", "This line was produced by Report.WritePhrase(...) and contains the following characters that should be html encoded > < & ");
Report.WriteLn(Report.TagBr);
Report.WriteText("View page source in browser to check HTML encoding");
]%>
</body></html>


 Run the skin against any .gno and examine the page source of the HTML produced. e.g.

<html><head><title>Tester</title></head><body>
<h1>Test to check Util.FormatPhrase versus Report.WritePhrase</h1>
This line was produced by Report.Write Util.FormatPhrase(...) and contains the following characters that should be html encoded > < & <br />
This line was produced by Report.WritePhrase(...) and contains the following characters that should be html encoded &gt; &lt; &amp;&nbsp;<br />
View page source in browser to check HTML encoding
</body></html>


The characters '> < &' appear unencoded from FormatPhrase.


'lego audio video erro ergo disco' or "I read, I listen, I watch, I make mistakes, therefore I learn"


tester.htm (119 views, 608 bytes)
Config.xml (103 views, 340 bytes)


Edited: Thursday, May 12, 2011 by GenoProSupport



Similar Topics

Click to view RSS...
Expand / Collapse

Reading This Topic

Expand / Collapse