title: Encoding issue reading HTML encoded strings from a SQLite file in iOS
body: <p>I have a SQLite file that contains a text column which can contain HTML encoded text. For example, it can contain a value like <strong><code>&amp;#35;Sample</code></strong>, which when displayed should be <strong>#Sample</strong> (<code>&amp;#35</code> is the HTML encoding for the # symbol).</p>
  
  <p>However, when I read that column's values using <code>sqlite3_column_text</code>, the text I get back is <em>double-encoded</em>. Instead of getting <strong><code>&amp;#35;Sample</code></strong>, the text I get back is <strong>&amp;&amp;#3535;Sample</strong>.</p>
  
  <p>I've double-checked the encoding of the database is UTF8, tried all other encodings, as well as many other obvious ways to debug this but can't figure out why this might be happening. My simple Objective C code is below. Can anyone think of what the problem might be?</p>
  
  <pre><code>const char *c = (const char *)sqlite3_column_text(statement, 0);
  NSString *stringValue = [NSString stringWithUTF8String:c];
  </code></pre>