This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes cant get the string from url Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "cant get the string from url " Watch "cant get the string from url " New topic
Author

cant get the string from url

pradipta kumar rout
Ranch Hand

Joined: Sep 13, 2010
Posts: 43
Sir,
I am using the URL class created a connection and want to read the content of the connection and want to store in the a file,
but I am not able to find the result it is encoded in some format as follow]

I have used following



I have surprised when saw the result in the contents.txt as follow

<meta name="keywords" content="वीडियो, निश�ल�क, सामान�य, खोजें, ढूंढें, तलाशें, देखें, ज�ड़ें, शेयर करें, शेयर करना, अपलोड करें, मनोरंजन">


instead of
<meta name="keywords" content="worst, twist, twists, endings, ever, 6th, sixth, sense, signs, village, M., Night, Shyamalan, smosh, anthony, padilla, ian, hecox, pit, WHY, ARE, YOU, READIN...">



Like above other contents are also encrypted I am not able to find any solution to get the right content to my file...

why this happening sir can you give any suggestion sir


Kindly give me any suggestion sir


Ernie Mcracken
Ranch Hand

Joined: Feb 13, 2011
Posts: 33

When i compile and run your code I get a 180k file that is all printable text.


<meta name="description" content="Welcome to Yahoo!, the world's most visited home page. Quickly find what you're searching for, get in touch with friends and stay in-the-know with the latest news and information.">
<meta name="keywords" content="yahoo, yahoo uk, yahoo home page, yahoo homepage,yahoo search, yahoo mail, yahoo messenger, news, finance, sport, entertainment,games">


Im guess your problem is probably a charset issue. How are you viewing the contents.txt file?


You're on a gravy train with biscuit wheels Roy.
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
When i compile and run your code I get a 180k file that is all printable text.

It worked for me too. ~215K file.
pradipta kumar rout
Ranch Hand

Joined: Sep 13, 2010
Posts: 43
Sir,
can you try the code with http://www.youtube.com

I am wrongly given http://www.yahoo.com
pradipta kumar rout
Ranch Hand

Joined: Sep 13, 2010
Posts: 43
Kindly help me please....
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: cant get the string from url
 
Similar Threads
can't able to retrive the string from url
searching a string a specific character sequence
Set an encoding scheme for InputStreamReader and ByteArrayOutputScream !!!
can't able to write the actual format on a file
ArrayList to file