0

I've stored string in an SQL database (android): ie:

    CREATE TABLE table ( type_t TEXT, description TEXT);
INSERT INTO fiche111 VALUES('p','Peut être allumée par la chaleur par des étincelles');

......

the matter is when a recover le string, all accents a repalced by en strange caractere [�] with an ? inside.

How can i resolve this and retrieve the correct accent of the original string?

thx in advance,

ShreeshaDas
  • 2,042
  • 2
  • 17
  • 36
morbak
  • 317
  • 4
  • 17

2 Answers2

0

Make sure your sqlite db encoding setting is UTF-8

Gyonder
  • 3,674
  • 7
  • 32
  • 49
0

The funny '?'-character is an indication of that the format of that certain character can not be understood because likely the entire text-encoding you are using is wrong.

Sqlite uses UTF-8 and UTF-16 (scroll halfway down on the page), so before inserting text in your table make sure, that the source text you are inserting is formatted like that too. When you retrieve your text back from your table, then make sure, that the view (or other destination you are using) is accepting text in that format also. If it is somehow impossible for the destination to accept UTF-8 (or 16), then you need to convert it to a format the destination understands first.

rickbear
  • 128
  • 1
  • 1
  • 8
  • ok, but how can i reslove this? Or what are the correct syntaxe to replace accent in th edatabase? – morbak Feb 27 '13 at 15:01
  • You need to _know_ what the format of your source text is, else every conversion would only be guessing. When you know, then one way (amongst many) of doing it could be [like this](http://stackoverflow.com/questions/88838/how-to-convert-strings-to-and-from-utf8-byte-arrays-in-java). – rickbear Mar 01 '13 at 19:24
  • I've use Notepad++ to convert the source text (ANSI->UTF-8) It's better, it's working now. – morbak Mar 05 '13 at 08:30