Jump to content

FontRich problem decoding symbols


photo

Recommended Posts

In last Unigine version, when FontRich::parse() is called, the symbols are decoded before any parse operation. This is a problem because, for example this string:

<p align="left">10<20</p>

is converted to:

"<p align="left">10<20</p>"

and then starts parsing operations, this causes the following error:

10:05:27 FontRich::parse(): unknown tag "<</p>"

 

In previous version, decode operation is done after text element is identified, I think this is correct way to do it. Why this code has been changed?

Link to comment

Maybe this is because this was fixed: WidgetLabel rich text

 

Thanks for your answer Eugene.

 

I think when you want to pass an xml string to any parser, the best way is to doit as follows:

 string s="<p align=\"left\">Is 10 < 20?</p>";
 myWidget.setText(s);

 

IMHO special symbols like '<','>','&', etc. used inside text elements can't be decoded before any parse process because this may cause invalid XML structures.

I think the old way was the correct one.

Link to comment

Afraid I don't understand you at 100 percent... but if you save your xml:

<p align=\"left\">Is 10 < 20?</p>

in a file and try to open in some xml editor or Internet Explorer, they show you an error: <p align=\" - this is not correct xml formatting. In Unigine xml must working as it working anywhere.

Link to comment

Afraid I don't understand you at 100 percent... but if you save your xml:

<p align=\"left\">Is 10 < 20?</p>

in a file and try to open in some xml editor or Internet Explorer, they show you an error: <p align=\" - this is not correct xml formatting. In Unigine xml must working as it working anywhere.

 

In my examples xml code is stored in a string variable ('"' must be scaped '\'):

string s="<p align=\"left\">Is 10 < 20?</p>";

traduced to xml document:

<p align="left">Is 10 < 20?</p>

That it's well formed.

Link to comment
  • 1 month later...
×
×
  • Create New...