From: Amith on 23 Feb 2010 12:53 Hello all, I have a problem, when i read a webpage contents (with UTF-8 characterset) and try to display it.. it is just considered as unicode string please help me here is the code import java.net.*; import java.io.*; public class URLReader { public static void main(String[] args) throws Exception { URL url = new URL("http://www.google.com/transliterate/indic? tlqt=1&langpair=en|kn&text=namskara%20guru&&tl_app=1"); BufferedReader in = new BufferedReader( new InputStreamReader( url.openStream(), "UTF8")); String inputLine = ""; String fullString = ""; while ((inputLine = in.readLine()) != null) fullString = fullString + new String(inputLine.getBytes(),"UTF-8"); String string = fullString.substring(fullString.indexOf("[\"") + 2, fullString.indexOf("\",]")); System.out.println(string); in.close(); } }
From: Amith on 23 Feb 2010 12:57 the URL in the above post would be "http://www.google.com/transliterate/indic?tlqt=1&langpair=en| kn&text=namskara%20guru&&tl_app=1"
From: Amith on 23 Feb 2010 13:02 URL used above is http://www.google.com/transliterate/indic ?tlqt=1&langpair=en|kn&text=namskara%20guru&&tl_app=1
From: Lothar Kimmeringer on 23 Feb 2010 13:03 Amith wrote: > I have a problem, when i read a webpage contents (with UTF-8 > characterset) and try to display it.. You left away the interesting part: What is your problem? Regards, Lothar -- Lothar Kimmeringer E-Mail: spamfang(a)kimmeringer.de PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81) Always remember: The answer is forty-two, there can only be wrong questions!
From: Amith on 23 Feb 2010 13:21 My problem is the UTF-8 string which i read from the URL is considered as unicode.. i need it as UTF-8 i want it to be printed as "ನಮà³à²¸à³à²à²°à²à³à²°à³" and not as "\u0CA8\u0CAE\u0CCD \u0CB8\u0CCD\u0C95\u0CB0\u0C97\u0CC1\u0CB0\u0CC1"
|
Next
|
Last
Pages: 1 2 3 Prev: Nightly build or daily build? Next: Error message I can't figure out |