From: Amith on
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
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
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
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
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"