Results 1 to 3 of 3
  1. #1

    selecting data from a pre made SQLite arabic database


    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 but I didn't find any usefull info please need help,

    My code is:

    public String getResult(int id)
            String name = null;
                Cursor c = null;
                c = bdd.rawQuery("select Title from List where _id="+id, null);
                name = c.getString(c.getColumnIndex("Title"));            
            catch(Exception e)
            return name; 
    I used a pre made SQLite database so I wrote the data into it from outside android;
    I encoded my database with UTF-8 using PRAGMA encoding = "UTF-8"; and I used:name = new String(c.getString(c.getColumnIndex("Title")).getB ytes(),"UTF-8"); but nothing worked!! I am still getting symbols instead of letters and that's just with the arabic letters, english letters are working just fine..

    Last edited by Makhlouk; 06-21-2013 at 01:59 PM.

  2. #2
    I inserted that:
                byte[] b;            
                b = c.getBlob(c.getColumnIndex("Title"));            
                name=new String(b,"UTF-8");
    instead of:
                name = c.getString(c.getColumnIndex("Title"));
    So now I am getting question marks, 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?!!


    Last edited by Makhlouk; 06-22-2013 at 07:26 AM.

  3. #3
    so my database was not utf-8 encoded and that was the problem and now I tried to encode it as utf-8 using notepad and this worked but if there's a better solution please tell me. thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts