How to save a SMS in a database - android

I am trying to save some SMS' in a SQLite database from a remote server using an XML parser. I am using urlencode() on server side (PHP) and URLDecoder.decode() on Android. Some of the special characters are replaced by � in the database.
I searched a lot and found that we need to convert UTF-8 to a GSM 7 bit encoding and some similar posts. Does anyone know how to solve this problem?
EDIT:
Here is an example of SMS which is encoded using urlencode()
I+Am+Da+Witness+2+His+Fearless+Death+I+Am+A+Token+Of+His+Last+Promise+%96+4giveness+I+Am+Da+CROSS+Blessings+On+Good+Friday...
that %96 is not supported by URLDecoder.decode()

Changed the text editor to use utf-8 without BOM and it worked!

Related

Is there any way of fetching the value of a key in remote JSON file, without downloading the whole HUGE JSON file?

I am a beginner in android development. I am on developing a dictionary app. The problem is quite obvious. I don't want the whole JSON file to be downloaded. I just want to send a key(a word in this case) and get its value(the meaning of that word) from the remote JSON. Any help would be appreciated.
Modify your server to support this sort of request, such as supporting a particular URL to retrieve values for a given key.

Fetching German characters from SQLite database in Android

I'm having difficulty fetching "special"/German characters (i.e. "öäüß") from my SQLite database using Android.
I'm using the SQLiteOpenHelper class to access the database and the characters show up as either a space or a rectangle.
I can select the fields in Command Line and they display properly, so I assume that they're stored correctly? However, I've used a number of GUI SQLite clients (SQLite Database Browser, sqliteman, Firefox's SQLite client) and none of them have succeeded in displaying the characters properly, so that seems odd, but the real problem is that they don't show up correctly in my app.
I have tried adding:
System.setProperty("file.encoding", "UTF-8")
and
System.setProperty("file.encoding", "ISO-8859-1")
I'm not entirely sure what this means, but I saw it mentioned in related posts so I'll include it:
SELECT hex('ä'); returns 84 and SELECT typeof(data) returns text.
Thanks very much!
84 is not the correct UTF-8 encoding of ä.
The Windows command prompt does not properly support UTF-8.
If you have entered the data from there, the encoding will be wrong.
Use the .read command to read the data from a UTF-8-encoded file, or enter the data with any of the GUI tools, which handle UTF-8 correctly.

Text convert into other format in android

I get response from the server correctly. But when i display the it in android app it get convert into some other text.
Please check below examples:
Balkánska 102 convert to Balkánska 102
OC Braník convert to OC Braník
and lot of more
Thanks in advance to suggest for this.
This is charset mismatch related issue. Enforce your remote server to send data in UTF8 or do convert what you get from server to UTF8 prior using in the app.
You need to make sure you are using the same encoding throughout the whole process. I can't say much else without some code examples.

MySQL database and Web service for Android App

While using MyPHP admin, I edit records in mySQL database that then is updated into my Android application.
If I paste data into one of my table fields, I often get "NULL" displaying in my app. If I paste the web service URL into a browser I still get the NULL value for that particular field.
After further experimenting, I noticed that editing some characters, that tend to be non-standard, the NULL is replaced with my data. This characters seem to be apostrophes, dashes, and brackets...etc.
Is there some way to do a mass conversion so all my data will paste into my table without editing special characters?
I have tried pasting into Notepad and other editors with the same result.
I then tried various means to ensure my tables were using utf8 character set. This yielded no data to my app. (the Browser method still worked). I don't remember adding anything to my app that set the charset.
Any ideas?
Thanks!
Hard to judge without sample data, url, etc. But I would say, given that this data will be displayed on a mobile device, that you probably would need to paste your data into something like TextWrangler, or NotePad++ and you will have to do a regular expression find and replace on all of the special characters. When you're finished, you would have to reimport into your database.
Another solution is to filter out the special characters right on the server. You could use the PHP str_replace function to filter out special characters as well.
I hope this helps!

Searching a SQLite database which contains cyrillic data

I have a problem searching my SQLite database, which contains data written with cyrillic characters. If the key word is also cyrillic, then everything is ok, but if not, then I can`t get the result in my Android application.
Does anyone have an idea how can I implement searching the cyrilic data no matter the charset of the keyword?
Thanks
If you use UTF8 encode, There will be no problem.
Actually not. String comparison works only with ascii characters (sort, upper, lower and like). If you are using non-ascii chars you should install plugin, which is like whole SQLite in size. Proof.
If you are interested in cyrillic symbols, try this link.
If you use UTF8 encode, There will be no problem.

Categories

Resources