0

I'm having difficulty fetching "special"/German characters (i.e. "öäüß") from my SQLite database using Android.

I'm using the SQLiteOpenHelper class to access the database and the characters show up as either a space or a rectangle.

I can select the fields in Command Line and they display properly, so I assume that they're stored correctly? However, I've used a number of GUI SQLite clients (SQLite Database Browser, sqliteman, Firefox's SQLite client) and none of them have succeeded in displaying the characters properly, so that seems odd, but the real problem is that they don't show up correctly in my app.

I have tried adding:
System.setProperty("file.encoding", "UTF-8")
and
System.setProperty("file.encoding", "ISO-8859-1")

I'm not entirely sure what this means, but I saw it mentioned in related posts so I'll include it:
SELECT hex('ä'); returns 84 and SELECT typeof(data) returns text.

Thanks very much!

MyiEye
  • 445
  • 1
  • 4
  • 14

1 Answers1

0

84 is not the correct UTF-8 encoding of ä.

The Windows command prompt does not properly support UTF-8. If you have entered the data from there, the encoding will be wrong.

Use the .read command to read the data from a UTF-8-encoded file, or enter the data with any of the GUI tools, which handle UTF-8 correctly.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • Oh, that makes lots of sense, thanks very much!! Yes, I just got the SQL statements in a UTF-8 encoded file and used .read and it worked like a charm. Thanks CL! – MyiEye Mar 20 '14 at 19:03