aspose file tools*
The moose likes Beginning Java and the fly likes How to decode a String in Java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

How to decode a String in Java?

Jingh Yi
Ranch Hand

Joined: Mar 23, 2005
Posts: 90
Hi All,

I have a question. Right now one of the field in our database, the Comments field, which is coming from other online systems, has encoded characters in it. For example, it's possible to have ''' in the Comments field instead of \'. Or '"' in the Comments field instead of \". How can I decode them back to \' and \" in Java? I tried java.net.URLDecoder.decode(comments) and it didn't work. What do I do?

Thanks!
Jinghui
Jingh Yi
Ranch Hand

Joined: Mar 23, 2005
Posts: 90
The encoded code for \' is '& # 39;'. On my previous post, '& # 39;' is automatically decoded by HTML to \'. The \" is encoded to '& QUOT;'. How do I decode them back to \' and \"?

Thanks!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

Hi,

Welcome to JavaRanch!

Please don't post the same question to more than one forum; it just wastes people's time. I'm going to close this copy and leave this one open.


[Jess in Action][AskingGoodQuestions]
 
jQuery in Action, 2nd edition
 
subject: How to decode a String in Java?
 
Similar Threads
How to decode a String with '& # 39;'?
New to XML
Character decoding in Java
how does servlet interpret parameter string ?
String to integer??