user1801564
user1801564

Reputation: 53

How can i use Unicode characters such as Germanic umlaut in an sqlite database?

I would like to use "Ä, Ö and Ü" in my sqlite database but when I use the snippet of code below, I am unable to retrieve the accented characters.

I am accessing the database using android or via sqlite3

CREATE TABLE haltestellen (
id integer primary key autoincrement,
name varchar(64)
);

insert into haltestellen(name) values("Bärenhof");

Upvotes: 1

Views: 5371

Answers (2)

a3f
a3f

Reputation: 8657

CREATE TABLE haltestellen (
id integer primary key autoincrement,
name varchar(64) charset utf8
);

insert into haltestellen(name) values("Bärenhof");

If this doesn't work, you should show the code you use and make sure that everything is using utf8

Upvotes: 1

Tia
Tia

Reputation: 2081

Sqlite only supports UTF-8 and UTF-16 (see this question) there should not be a problem with your charset.

I guess that the terminal or tool you use to make the queries just does not support UTF-8 (or doesn't have it enabled). Just use a terminal or tool that supports UTF-8 and you should be fine.

As you do not give any more information I assume that you use the windows terminal cmd.exe. You could try what was suggested in this question:

chcp 65001

Still, for a better suited answer you will have to provide more information about your setup, like what are you actually trying where.

Upvotes: 3

Related Questions