Text convert into other format in android - 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.

Related

How to parse a u' prefixed JSON response in Android

I'm trying to parse a JSON response, but all the fields are u' prefixed. I did some search its Unicode format, not UTF-8 realised, but how to parse it finally in Android?
"{u'response': [{u'status': u'ONGOING', u'challenge_type': u'Monthly Challenges', and so on
Online JSON Viewer is formatting it but since it's Unicode, so all are chars, that's not the way we can parse JSON response.
In my code even creating a JSONObject is also throwing an exception.
Any solution or hint towards correct path would be very helpful.
JSON link
For those who are giving a downvote please leave a solution before the downvote, would really like to know what I missed out.
That is not JSON. That's a Python dict literal. Although Python and JS literals are superficially similar they are far from cross-compatible.
You could parse it from Python using ast.literal_eval, but that's not much use from Android, and it would be a very strange web API that chooses Python literals for its output format. If you have a web service that is supposed to be returning JSON but is actually returning this, it's broken.

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.

How to save a SMS in a database

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!

How do you Upload a raw image using AJAX?

I am currently getting a base64 encoded image from a mobile device's camera using PhoneGap, I would like to upload the image to a server to then store. Not sure what the right approach is?
As expected, if I try to include the base64 string as a parameter I get the Error 414 (Request-URI Too Large)
Even if you use POST the server accepting the POST will need to be capable of decoding the base64 parameter. Luckily the PhoneGap API provides a better way to do this with FileTransfer.
You need to get the file handle to the image instead of the base64 encoding. Using the file handle resolves the issue of getting a JavaScript out of memory error. This also removes any cross-site scripting issues since PhoneGap is using native code to perform the post instead of using the browser. Hope that helps.
I agree with Chuck you are better off using the FileTransfer object. Large Base64 strings will cause out of memory errors in your app. Zac has a good tutorial on the subject:
http://zacvineyard.com/blog/2011/03/25/upload-a-file-to-a-remote-server-with-phonegap/
Why not use HTTP POST instead of HTTP GET?

Upload image from Android to WCF service

I'm looking for a complete example for uploading an image + some text fields from Android to a WCF service. I've been searching for days without finding any useful examples. What I need is the code for both the client and server.
I've been able to make it work with JSON and Base64 encoding the image as a string, but this is way too slow with images around 500KB. What I'm looking for has to be efficient. Probably using a stream.
Can anyone please give me a complete sample code? I've seen a lot of snippets on each side, but not a complete sample. From getting the image from a path on the phone to posting it to the server and consuming it on the server in C#? How to get the image as a bytearray on the server and the text into string variables?
Thanks for listening.
For setting up WCF streaming on the server side see : http://msdn.microsoft.com/en-us/library/ms789010.aspx
You could also try just using basic http binding and MTOM.
For the android part you will need to get help from someone else, sorry.

Categories

Resources