I have a SQLite file that contains a text column which can contain HTML encoded text. For example, it can contain a value like #Sample
, which when displayed should be #Sample (#
is the HTML encoding for the # symbol).
However, when I read that column's values using sqlite3_column_text
, the text I get back is double-encoded. Instead of getting #Sample
, the text I get back is &ාSample.
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?
const char *c = (const char *)sqlite3_column_text(statement, 0);
NSString *stringValue = [NSString stringWithUTF8String:c];