Velocity Reviews

Velocity Reviews (
-   Software (
-   -   UTF8 problem in Java (

mabs 03-18-2009 09:55 AM

UTF8 problem in Java
Hi All,

I am trying to read a web page. It contains unicoded forign language characters. I want to save that particular information only. But if I save the whole page, it looks normal and is written as UTF-8. But when I write only the particulatar string in it, it look as garbage. Infact the file is saved as ANSI. What should I do now?

URL url1 = new URL("-----");
BufferedReader in = new BufferedReader( new InputStreamReader(url1.openStream()));
PrintWriter out= new PrintWriter(new BufferedWriter(new FileWriter("test.txt")));
String str;
int n = 0;

while ((str = in.readLine()) != null){

if(str.contains("<td class='urdu-cell' align=right valign=top>") )

n=str.indexOf("<td class='urdu-cell' align=right valign=top>");
str = str.substring( n,n+str.indexOf("td") );

mabs 03-18-2009 09:56 AM

So sorry that I cannt post the URL link

susith 03-27-2009 05:37 AM

Use constructor

public InputStreamReader(InputStream in,
String charsetName)

All times are GMT. The time now is 10:15 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.