Note that there are some explanatory texts on larger screens.

plurals
  1. POselecting data from a pre made SQLite arabic database
    text
    copied!<p>I have a SQLite(s3db) database with arabic and english words and I placed the local in there as en_US and I am trying to get some arabic data from it but I can't I am getting symbols instead of letters what should I do, I searched for it found that I should work on encoding UTF-8 or.. but I didn't find any details and usefull info please need help,</p> <p>My code is:</p> <pre><code> public String getResult(int id) { String name = null; try { Cursor c = null; c = bdd.rawQuery("select Title from List where _id="+id, null); c.moveToFirst(); name = c.getString(c.getColumnIndex("Title")); c.close(); } catch(Exception e) { e.printStackTrace(); } return name; } </code></pre> <p>I used a pre made SQLite database so I wrote the data into it from outside android see <a href="http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/" rel="nofollow">link</a></p> <p>thanks.</p> <p><em><strong>Edit:</em></strong></p> <pre><code>I inserted that: byte[] b; b = c.getBlob(c.getColumnIndex("Title")); name=b.toString(); name=new String(b,"UTF-8"); instead of: name = c.getString(c.getColumnIndex("Title")); </code></pre> <p>So now I am getting question marks in black boxes, I checked to see if my database is UTF-8 encoded and yes it is so what's causing that I am really working on this since hours now any help?!!</p> <p><em><strong>EDIT2</em></strong> SO my database is not utf-8 encoded the arabic words are written as ansi or iso.. and I tried to use:</p> <pre><code>name = new String(c.getBlob(c.getColumnIndex("Title")), "UTF-8"); byte[] chars = name.getBytes("ISO-8859-1"); String utf8 = new String(chars,"ISO-8859-1"); name=utf8; </code></pre> <p>to transform their encoding to a readable encoding with android but that didn't work as I don't know which encoding to add anyone has an idea about that?</p> <p><em><strong>EDit3:</em></strong> So basically I could solve this as I placed the arabic words in notepad++ as UTF-8 and pressed ansi so notepad transformed my words to utf-8 and then I can place them like that in my database and I retrieved data from it and it worked...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload