title: What is the best value for "Unit Separator" in XML?
body: <p>I used Unit Separator (US/0x1f) in database. When I export to XML 1.0 file, it is not accepted and leave the attribute with empty value.</p>
  
  <p>I have data in database like this: </p>
  
  <p>"option1=10;option2=20;option3=aaa[US]bbb[US]ccc;" </p>
  
  <p>I'm assuming to export to XML 1.0 file like this: </p>
  
  <p>&lt;elementname, attr1="option1=10;option2=20;option3=aaa[US]bbb[US]ccc;"/&gt;</p>
  
  <p>However, the [US] is not accepted by XML 1.0. Any suggestions?</p>
  
  <p>I can replace '\37' (oct 37, hex 1f) with something like "XXX", "$", "(0x1f)"... before writing to XML;</p>
  
  <p>I can replace it when importing from XML and write to database. However, if I replace it with "&amp; # x 1 F ;", which is the HTML Entity for Unit separator, I end up with "&amp; a m p ; # x 1 F ;", which is definitely not what I wanted.</p>
  
  <p>If I manually modify the XML file to "&amp; # x 1 F ;", I can not use MSXML to load it, giving error "Invalid Unicode Character".</p>
  
  <p>Any suggestions?</p>
  
  <p>Thank you</p>
  
  <hr>
  
  <p><strong>Summary:</strong></p>
  
  <p>Let's make an analogy: Let's think about how the compiler works, there are two phases: "Pre-compile" and "Compile".</p>
  
  <p>For XML File Generation, it acts like the "Compile" phase. E.g. convert "&lt;" to "&amp; l t ;"</p>
  
  <p>However, the Unit Separator is not supported by XML 1.0, so the "Compile" phase will not convert it to HTML Entity "&amp; # x 1 F ;"</p>
  
  <p>So we have to seek solution in the "Pre-Compile" phase, which is our own application's responsibility. </p>
  
  <p>When writing:</p>
  
  <pre><code>Option1: &lt;unit&gt;aaa&lt;/unit&gt;&lt;unit&gt;bbb&lt;/unit&gt;
  Option2: simply use "_x241F_" to replace "\37" in the string if "_x241F_" is not conflicting with any existing token in the string.
  </code></pre>
  
  <p>When reading:</p>
  
  <pre><code>According to Option1: Load the elements, catenate to a single string with "\37" as separator.
  According to Option2: simply use "\37" to replace "_x241F_".
  </code></pre>
  
  <p>I've also found out that MSXML (even the highest version MSXML6.dll) will not load XML 1.1 .</p>
  
  <p>So if we are unfortunately using MSXML, we have to write our own "Pre-Compile" code to handle the Unicode characters before feeding the "Compile" phase.</p>
  
  <p>Note: I borrowed the idea of "_ x 2 4 1 F _" from <a href="http://msdn.microsoft.com/en-us/library/bb500235.aspx" rel="nofollow">here</a>.</p>
  
  <p>Thanks for everyone's help</p>