iOS, sqlite3 & unicode char -
for app want able use unicode caracters \n, , these ones : http://www.easyapns.com/category/just-for-fun
the text stored in sqlite3 database, , when read it, example text \ue415 instead of smiley. neither have line break, \n .
i'm able display smileys , line breaks using piece of code :
nsstring* unicodestring = [mystring stringbyreplacingoccurrencesofstring:@"\\n" withstring:@"\n"]; unicodestring = [unicodestring stringbyreplacingoccurrencesofstring:@"\\ue022" withstring:@"\ue022"]; // etc...
but find generic way this, in order able display unicode caracters.
i'm getting text sqlite3 database way :
nsstring* title = [nsstring stringwithutf8string:(char *)sqlite3_column_text(statement, 3)];
i tried replace \\ \, not possible write string @"\", because escapes " ... tried replace \\\\ \\, doesn't work. tried string database using other encoding, without success...
any idea ?
i found solution there (not accepted answer, 1 nikolai ruhe) :
using objective c/cocoa unescape unicode characters, ie \u1234
nsstring* convertedstring = [mystring mutablecopy]; cfstringref transform = cfstr("any-hex/java"); cfstringtransform((__bridge cfmutablestringref)convertedstring, null, transform, yes);
it not escape \n though, can easilly done stringbyreplacingoccurrencesofstring.
Comments
Post a Comment