title: Escaping of hex values in string literals
body: <p>I am attempting to escape a specific hex value in a golang string. The function call looks something like this:</p>
  <pre><code>Insert(0, &quot;\x00\x00\x00\rIHDR\x00\x00\x000\x00\x00\x000\b\x03&quot;)
  Insert(25, &quot;\x00\x00\x00\x06PLTE&quot;)
  Insert(43, &quot;\x00\x00\x00\x02tRNS&quot;)
  Insert(57, &quot;\x00\x00\t;IDATx\xDA\x010\t\xCF\xF6&quot;) // problem line
  Insert(2432, &quot;\x00\x00\x00\x00IEND&quot;)
  </code></pre>
  <p>The problem arises when the language interprets the &quot;\xDA&quot; hex escape. Instead of correctly escaping to a Ú value, it is escaped to � (the Replacement Character).</p>
  <p>I ensured this is what was occuring in the following playground example:</p>
  <pre><code>fmt.Println(&quot;\xDA&quot;)
  i := 218
  h := fmt.Sprintf(&quot;%x&quot;, i)
  fmt.Printf(&quot;Hex conf of '%d' is '%s'\n&quot;, i, h)  
  fmt.Println(string(i))
  </code></pre>
  <p>This snippet, when run, prints</p>
  <pre><code>�
  Hex conf of '218' is 'da'
  Ú
  </code></pre>
  <p>Am I missing something here? The fact that &quot;\xDA&quot; is being escaped to a value of 65533 is throwing off my entire program, which relies on the CRC32 and some other checksums. This does not occur in the <a href="https://github.com/JohnDDuncanIII/messagefaces/blob/master/chrome/content/lib/xface.js" rel="nofollow noreferrer">javascript version</a> of this program (which itself is a translation from James compface program, written in C).</p>
  <p>Here is the playground link: <a href="https://play.golang.org/p/c-XMK68maX" rel="nofollow noreferrer">https://play.golang.org/p/c-XMK68maX</a></p>