Quantcast
Channel: Web Traffic Exchange - html
Viewing all articles
Browse latest Browse all 10

How do you XML encode your data?

$
0
0

I was using jqgrid to display some "filtered" data on grid, but some filters won't display any data. My immediate suspect was special characters that may interfere with XML markup.

jqgrid table

After looking at Extensible Markup Language (XML) 1.0 (Second Edition) specification, disallowed characters are defined in IETF RFC 2396 except for (#), (%) and square bracket characters are re-allowed. Per W3 recommendation, there are three ways as recommended.

  • Each disallowed character is converted to UTF-8
  • Any octets corresponding to a disallowed character are escaped with the URI escaping mechanism (that is, converted to %HH, where HH is the hexadecimal notation of the byte value).
  • Better yet, enclose your data in <![CDATA[ your text here ]]>
Tags: 

Viewing all articles
Browse latest Browse all 10

Trending Articles