1

I have an encoding problem in my database. This database is first imported form another app (written in .NET so microsoft app). So I get an .sql file and then I download it and run it in myphp admin and there I can see the varchars are in utf8.

Then I use this (WONDERFUL by the way) script to create a sqlite database AUTOMATICALLY:

https://gist.github.com/943776

Then I have my DB file and I put it in the assets folder of my app using basically this technique: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

to use the DB and not to create a new one.

Well everything works perfectly fine the only thing is my apopp is in spanish and the coding is not quite right for letters like è, é, ª etc.... I have checked with PRAGMA encoding;

but the encodign if utf-8, what do you advise me to do??? I mean a part from rewrtiging the DB???

Thanks a lot

vallllll
  • 2,731
  • 6
  • 43
  • 77
  • How does the DB file look in a tool such as SQLite Database browser? Have you tried importing the SQL file using that tool? Does the .sql file look fine within an editor such as Notepad++? – Vincent Mimoun-Prat Jul 18 '11 at 15:29
  • Do you read this comment: https://gist.github.com/943776#gistcomment-32725? – jamapag Jul 18 '11 at 15:34
  • jamapag: thanks, I have posted a questio there too, will update here once I get the answer. MarvinLabs: the original DB in sql looks fine either the .sql file either the online localhost version but the sqlite DB has the encoding problem in Sqliteman (grafic tool to see DB) too and comand line it has also the same problem with encoding – vallllll Jul 18 '11 at 16:23

2 Answers2

0

I found that SQLite Database browser 2.0 only shows Western (ISO Latin 1) correctly when importing a csv made in Numbers

mameluc
  • 665
  • 5
  • 13
0

Android sqlite uses UTF-8 by default. And may only use UTF-8 and UTF-16. Did you check to init your Strings retrieved from sqlite like this:

new String(row.getString().getBytes(), "UTF-8")

You may also check the other options with pragma.

fyr
  • 20,227
  • 7
  • 37
  • 53
  • thks fyr, I have tried your method but i still get some chineese characted inside my text instead of letters like é or ç and when I check the DB on the comand line it's the same: 2|12|Proced�ncia|0|| 3|13|Demandes|1|| 4|14|On s'allotja|0|| 5|15|N� de persones|0||1 – vallllll Jul 18 '11 at 15:39