After scanning the "ADDRESSBOOK" type from QR code, the content that I get is the simple string like:
Sandeep
abc
def
;;my new address
+908888888888
+901111111111
+902222222222
homeemail#example.com
workemail#example.com
http://www.google.com
Now I want to convert this string into vCard and open the address book of the device(phone) with all these contents filled on the specific column...I researched a lot but no Idea. Please guide me into this.
EDIT:
check this QR code:
I have created this vCard type QR code using http://goqr.me/
but after scanning, It just shows the content, not in the vCard format. But I want to convert this simple comtent into vCard.
Please help..
What does each line your code sample represent? The vCard would look something like this:
BEGIN:VCARD
VERSION:3.0
FN:Sandeep
ADR:;;123 Street;City;Region;PostalCode;Country
TEL:+908888888888
TEL:+901111111111
TEL:+902222222222
EMAIL;TYPE=home:homeemail#example.com
EMAIL;TYPE=work:workemail#example.com
URL:http://www.google.com
END:VCARD
Related
I'm using Jsoup to get html from web sites. for example I have the links in my HTML page look like this:
String url="http://kitchen.sayidaty.net/node/8544/كوكيزبالشوفان/حلويات";
Document doc=Jsoup.connect(url).get();
this link parse NOTHING and throws IOException, but when I open this link manually in browser and take it back to my code it get changed and works fine ! like this :
String url="http://kitchen.sayidaty.net/node/8544/%D9%83%D98%B2-%D8%A7%D9%86/%D8%AD%D9%84%D9%88%D9%8A%D8%A7%D8%AA#ingredients";
Document doc=Jsoup.connect(url).get();
is there any way to get the absolute link (the second one) , I tried this but same result :'(
link.attr("abs:href")
The problem you're facing has to do with the charset specification http protocol handle when you do transactions like POST and GET. You must use a application/x-www-form-urlencoded MIME format (For more information about HTML form encoding, consult the HTML specification).
In your case, for this to work you have to use Android URLencoder, but only at the end of the address you want to use, to avoid problems. So transform:
String url="http://kitchen.sayidaty.net/node/8544/كوكيزبالشوفان/حلويات";
Into:
String auxUrl= URLEncoder.encode("كوكيزبالشوفان/حلويات", "utf-8");
String url="http://kitchen.sayidaty.net/node/8544/" + auxUrl;
Then proceed with your
Document doc=Jsoup.connect(url).get();
I have an Android app which uses
URLEncoder.encode(S.getSongArtist(),"UTF-8")
to encode a unicode string that is posted to a AppEngine python (2.7) web service. On the service I use
urllib.unquote_plus(artist)
This is not giving me correct results. I have an input like this:
Marie+Lafor%C3%AAt
which is unquote'd to
Marie Laforêt
If I use a javascript url decode, for instance: http://meyerweb.com/eric/tools/dencoder/
I get
Marie Laforêt
A correct result.
I tried using
urllib.unquote(artist).decode('utf-8')
but this generates an exception. Any hints at all are greatly appreciated.
EDIT
Taxellool had the right answer in the comments:
what you are trying to decode is already decoded. try this:
urllib.unquote_plus(artist.encode('utf-8')).decode('utf-8')
Taxellool had the right answer in the comments:
what you are trying to decode is already decoded. try this:
urllib.unquote_plus(artist.encode('utf-8')).decode('utf-8')
I guess you are decoding before urllib.unquote():
>>> print urllib.unquote_plus('Marie+Lafor%C3%AAt'.decode('utf-8'))
Marie Laforêt
If you decode after unquote, result would be what you want:
>>> print urllib.unquote_plus('Marie+Lafor%C3%AAt').decode('utf-8')
Marie Laforêt
Just make sure you don't pass a unicode to urllib.unquote_plus.
I am use zxing library for scanning data matrix barcode. I use zxing for barcode for scanning data matrix barcode type :
Barcode image :
Which has following detail :
LOC : VIP/ROYAL
item : 30000701293
UOI : Each
PAR : 35/50
It is working fine. I got properly output in contents.
Output :
1L+SK_CON_STR21LVIP/ROYAL.VIP/ROYAL....000000P+30000701293U+Each
So, how can i bifurgate all details ?
You parse it by writing Java code. Whatever this text is, its format is not a general standard, and so there is no library code that is already going to parse it.
I want email with image which is fatch from drowable in android I show bellow given link but same problem arise:
How to add an image in email body
and if I put
email.putExtra(Intent.EXTRA_TEXT,Html.fromHtml("<b>content</b>"+"<img src=\"data:"+getResources().getDrawable(R.drawable.smile)+";base64,#IMAGEDATA#\">")
and save it it give the Error:
Save Could not be completed
some character can not be mapped using "Cp1252" Character encodding.
please give me the solution, I want send image with mail.
Try this it will really help you:
mail.putExtra(Intent.EXTRA_SUBJECT, subject.toString());
mail.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:"+ file));
In my app I receive a URL such as
http://www.wassersportlotse.de/php/lib/smart_image_resizer/image.php/Mühlendammschleuse.jpg?image=/media/images/uploads/Mühlendammschleuse.jpg
When there are no German characters in the fullurl I can just use it without encoding and it works fine. However if I receive a URL such as the one above it doesn't work (the ü is causing the problem). Below I have tried to encode the seperate parts of the URI to no avail. As alway advice is very much appreciated.
public ImageDownloader(String fullurl) throws URISyntaxException{
URI uri = new URI(fullurl);
path = uri.getPath();
path = URLEncoder.encode(path);
query = uri.getQuery();
query = URLEncoder.encode(query);
auth = uri.getAuthority();
url = "http://" + auth + path + query;
}
Maybe the encoder das encode the Umlaut as UTF-8 characters (so ü would be encoded with two characters) and they are not put back together properly at the server (for us it didn't work with Tomcat). To solve this situation we used URLEncoder.encode(param, "ISO-8859-1") to encode the parameters.
There's no simple answer, because it depends on the server serving that URI which encoding is expected.
Usually it's UTF-8.
In that case: use String.getBytes, specifying the UTF-8 encoding, and obtain a byte array from that. Re-encode that byte array as string by taking all bytes <= 127 as-is, and substituting all others by the %hh form. (percent sign, then two hex digits). See http://greenbytes.de/tech/webdav/rfc3986.html#rfc.section.2.1.
You can use Android's Uri class to help you out. That class has an encode() method which will use UTF-8 to encode your string.
I recently had a problem with URLs for images whose names included umlauts and German special characters, and I lost a day looking for the solution. The images simply did not appear if there was an ä or and ü in the file name or the directory name. I thought it might be spring, or some other Java technology I am working with, or in the browser. And strangely enough, even with the url encoded, it failed to find the image. But in the end, the solution was in my tomcat server.xml configuration. In your server.xml file, find your connector and add these two lines:
URIEncoding="UTF-8"
useBodyEncodingForURI="true"
At the end, it should look something like this:
<Connector connectionTimeout="20000"
port="8080"
protocol="HTTP/1.1"
redirectPort="8443"
URIEncoding="UTF-8"
useBodyEncodingForURI="true"/>
Now I do not need to url-encode the url. This is a help to my clients, because they can see the German words in the urls spelled correctly.
Here is another tip: if you are coding in eclipse and starting and stopping your server from inside eclipse, then the configuration file (server.xml) could be in your eclipse workspace in the Servers folder. It must be changed here for it to work with eclipse. This can be maddening, when you have made the change in your principal tomcat configuration, and the urls work there, but they are still broken when running the server in eclipse.
That did it for me. I hope it helps someone out there! :-)
Have your tried unsing:
android.net.Uri.encode(urlString, ":/");
It encodes the string but skips ":" and "/".