Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
SamZ
Level 7

XML encoding

Is there a[n easy] way to encode a string with " and other special characters? Even if I could find the escape character ("\"" in JS) I could replace it ...
0 Kudos
5 REPLIES 5\
RokuChris
Roku Employee
Roku Employee

Re: XML encoding

Not sure if this answers your question, but if you build an XML structure using roXMLElement, then call its GenXML() function, all the strings should be encoded properly in the result.
0 Kudos
SamZ
Level 7

Re: XML encoding

That might help, thank you! But in general, how can you escape double quotes in a string in Brightscript?
0 Kudos
TheEndless
Level 9

Re: XML encoding

"SamZ" wrote:
That might help, thank you! But in general, how can you escape double quotes in a string in Brightscript?

Chr(34)
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
SamZ
Level 7

Re: XML encoding

BTW, BrightScriptReferenceManual.pdf says:
GenXML(gen_header As String) As String but passing a string to the function throws an error! It turns out the parameter has to be Boolean! Further down the doc has this:
"GenXML() takes one parameter (boolean) that indicates whether the generated xml should have the <?xml …> tag at the top."
0 Kudos
EnTerr
Level 11

Re: XML encoding

"SamZ" wrote:
BTW, BrightScriptReferenceManual.pdf says:
GenXML(gen_header As String) As String but passing a string to the function throws an error! It turns out the parameter has to be Boolean!

OK, this is kinda ridiculous: it has been almost two years and this has not been corrected. I just faced it

Glad searching the forum for GenXML pulled this info.

Two years! Seriously Roku dudes, fix it.
0 Kudos