Skip to content

RFC: UTF 8 Support in EasyXML #6

Jim Kring edited this page Feb 25, 2020 · 2 revisions

About

  • Date: 2020-02-25
  • Author: Jim Kring
  • Discussion: Here

Background

EasyXML does not do any treatment of string data when writing to or reading from XML, which means that it's not necessarily UTF-8 encoded when there are special characters like the degrees character ("°") in "°C". This causes problems for some XML parsers (e.g. Excel) when these special characters are found in the data. It would be good if EasyXML would do proper UTF-8 encoding.

Proposal

Use the primitive LabVIEW string to UTF-8 conversion functions, shown below, to UTF-8 encode/decode the data.

image

image

These functions could be called inside of "Easy Generate XML" and "Easy Parse XML" to handle the encoding and decoding of UTF-8 data.

We would add a new input to "Easy Generate XML" called "Encoding" and if the value is "UTF-8" then we would encode the data as such (question: should we default to UTF-8? would that hurt anyone's existing code that relied on the old behavior?)

image

We would add some smarts inside of "Easy Parse XML" to check for the encoding inside of the root "" tag (e.g. "<?xml version="1.0" encoding="UTF-8"?">

image

Open Questions

  • Should the new Encoding input on "Easy Generate XML" default to "UTF-8"? would that hurt anyone's existing code that relied on the old behavior?)

Please discuss here

Clone this wiki locally