When you are developing an iPhone application, you will most likely have to use an internal database to store your data. I also needed a database for my Facts iPhone application. As the app contains german words, it also contains umlauts and special characters like äöü and all this stuff that is not present in the english language. However, I was not able to support these special characters although I used UTF8 encryption in my application.
To create the database, I used the following commands in terminal:
cd Desktop
mkdir FactsDatabase
cd FactsDatabase
sqlite3 facts.sqlite
Now you will see the sqlite command prompt which only accepts sql commands from now on. This is where I have created my database, and inserted some facts:
// create table
create table facts(id integer primary key, fact text, isFavorite varchar(5), alreadyRead varchar(5));
// fill database with facts
sqlite3 facts.sqlite “INSERT INTO facts(fact, isFavorite, alreadyRead) values(‘Täglich werden 12 Neugeborene den falschen Eltern gegeben.’, ‘no’,'no’);”
Now if you do it like this, the special characters won’t show up in your application. After some hours of trying I tried to use run my sqlite commands in a shell script. I had to rearrange the commands to fit like this:
# drop exising table
sqlite3 facts.sqlite “drop table facts;”
# create database
sqlite3 facts.sqlite “create table facts(id integer primary key, fact text, isFavorite varchar(5), alreadyRead varchar(5));”
# fill database with facts
sqlite3 facts.sqlite “INSERT INTO facts(fact, isFavorite, alreadyRead) values(‘Täglich werden 12 Neugeborene den falschen Eltern gegeben.’, ‘no’,'no’);”
Save it as database.sh and in terminal, give it the rights to execute: chmod+x database.sh, and then run it with ./database.sh
If you do it like this, the special characters are finally in the database and will show up in your application. To be honest, I have no idea why it only works with this workaround. It costed me quite a bit of time. Anyway, hope that helps anyone. If you have questions, use the comment section. Cheers.