i've tried to parse a mailto url which contains Japanese or Chinese characters by using MailTo.parse(url) but it return null. it's ok with English characters. How do I resolve that? There's my code and logcat:
try {
url = URLDecoder.decode(url,"UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Log.d(TAG, "url: " + url);
MailTo mt = MailTo.parse(url);
Log.d(TAG, "body: " + mt.getBody());
Log.d(TAG, "subject: " + mt.getSubject());
07-12 12:50:34.861: D/Fbaku(9484): url: mailto:?subject=幕末の時代を生き抜け!&body=iPhoneとiPod Touch対応の風雲幕末史を一緒にやりませんか?
07-12 12:50:34.861: D/Fbaku(9484): subject: null
07-12 12:50:34.861: D/Fbaku(9484): body: null
Edit: sorry, my mailto url contains a link in body like this: https://stackoverflow.com/posts/17607307
So MailTo.parse(url).getBody() and MailTo.parse(url).getSubject() return NULL
How can i fix it?
try by using toString() method
so change
Log.d(TAG, "body: " + mt.getBody());
Log.d(TAG, "subject: " + mt.getSubject());
to
Log.d(TAG, "body: " + mt.getBody().toString());
Log.d(TAG, "subject: " + mt.getSubject().toString());