This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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 Elasticsearch in Action this week in the Big Data 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: 24189
    
  34

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to decode a String in Java?