Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

How to decode a String in Java?

 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic