I got a string \x3Cb\x3EHello, World\x3C\x2Fb\x3E
as a webresponse..i think it means <b>Hello, World</b>
but i don't know how to unescape that sequence into java string..could anyone please help me with this??
Thank you.
cool_zephyr
7
Junior Poster in Training
Recommended Answers
Jump to Postyou can use methods of the java String class to extract hello world out of the string above. the methods are all listed there. i dont know much about web stuff , but …
Jump to Posttry this regex pattern
H\w+,\s+W\w+
this is tailor made to get "Hello, World".it starts with H , looks for all word characters from H (the
\w+
part), this stops at the first comma , then include one or many whitespace (via\s+
) , then do what you did in …
Jump to Posti don't know how to unescape that sequence into java string..could anyone please help me with this??
That's not how a normal HTML response looks like. If that service is in your control, the first action should be to investigate why you are getting hex encoded HTML entities …
Jump to PostHave a look at the URLDecoder class
http://docs.oracle.com/javase/6/docs/api/java/net/URLDecoder.html
Jump to PostURL encoding/decoding rules are different from the HTML ones hence URL decoder should only be used for decoding URLs. HTML encoding uses ampersand encoding (
&
) whereas URL encoding uses%
encoding.For HTML decoding, the StringEscapeUtils class from Apache commons should be used.
All 21 Replies
somjit{}
60
Junior Poster in Training
Featured Poster
cool_zephyr
7
Junior Poster in Training
somjit{}
60
Junior Poster in Training
Featured Poster
cool_zephyr
7
Junior Poster in Training
somjit{}
60
Junior Poster in Training
Featured Poster
somjit{}
60
Junior Poster in Training
Featured Poster
cool_zephyr
7
Junior Poster in Training
somjit{}
60
Junior Poster in Training
Featured Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
somjit{}
commented:
good info
+0
cool_zephyr
7
Junior Poster in Training
somjit{}
60
Junior Poster in Training
Featured Poster
cool_zephyr
7
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
somjit{}
60
Junior Poster in Training
Featured Poster
cool_zephyr
7
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
cool_zephyr
7
Junior Poster in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
cool_zephyr
7
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.