Click here to Skip to main content
14,974,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I want use persian (unicode) string to inserting into contact database in android but in the phone i get something like '?????????' how i can store that word in db?
Java
ContentValues values = new ContentValues();
values.clear();
values.put(ContactsContract.Data.DATA3, "شماره");

this.getContentResolver().insert(ContactsContract.Data.CONTENT_URI , values);
Posted
Comments
Richard MacCutchan 23-Apr-15 11:57am
   
This usually happens because the default font for displaying data is set to the Latin alphabet. Find out how to switch to a Persian font.
Jitendra Ku. Sahoo 24-Apr-15 2:21am
   
You need to use proper encoding for this. Also use proper datatype like NVARCHAR in-place of VARCHAR datatype to store data.
Behnam Mohammadi 24-Apr-15 2:39am
   
no, i can't modify database schema, i want to store that word into contact db it is system db.

1 solution

don't use hardcode use string.xml it will be solved.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900