| Webtraffic Exchange | Development, Framework, Peripherals

Encode XML Data

I was using jqgrid to display some "filtered" data on the 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 ]]>
Share this Post: Facebook X LinkedIn Email


0 Comments

Comments are moderated to keep the discussion useful and respectful. Spam, automated submissions, and low-value promotional comments are removed.

  • No comments have been published yet.

Leave a Comment

Related Articles