"EnTerr" wrote:
The strings already have getEntityEncode() method. The opposite is a one-liner:PRINT (myStringExpression).replace(""", """").replace("'", "'").replace("<", "<").replace(">", ">').replace("&", "&")
"philotas" wrote:
Update: I found that the above mentioned XmlDecode Function indeed work but it a quick test I did showed, that it does not work with entity names: For example € works but € does not
"philotas" wrote:
I receive (simple) HTML formatted text from a server via JSON and want to display it in Label.
I strip out some tags, but there could be some HTML Entities which I want to convert.
"EnTerr" wrote:"philotas" wrote:
I receive (simple) HTML formatted text from a server via JSON and want to display it in Label.
I strip out some tags, but there could be some HTML Entities which I want to convert.
Do you have the leeway to change that, as in simply not sending HTML?
Brightscript Debugger> xml = CreateObject("roXmlElement")
Brightscript Debugger> ? xml.parse("<x>€ and €</x>"), xml.getText()
false
Brightscript Debugger> ? xml.parse("<x>just €</x>"), xml.getText()
true just €
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE x PUBLIC "-//W3C//ENTITIES Special for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
<x> ...
Brightscript Debugger> dtd2 = "<!DOCTYPE x [ <!ENTITY euro ""€""> ]>"
Brightscript Debugger> ? xml.parse(dtd2 + "<x>mwa€hahaha</x>"), xml.getText()
true mwa€hahaha
"philotas" wrote:
I receive (simple) HTML formatted text from a server via JSON and want to display it in Label.
I strip out some tags, but there could be some HTML Entities which I want to convert.
text = text.Replace(Chr(8208), "-")