• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

How to decode a String with '& # 39;'?

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • 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 '& # 39;' in the Comments field instead of \'. Or '& QUOT;' 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
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you need to do that? The escape sequences \' and \" are there for the compiler's sake, not the JRE. That is, if you had:



that could be equivalent to:



If the database has in the SENTENCE field:

Then sentence1.equals(sentence2) is true.

Or---Did I misread your question?

Does the database contain

[ March 23, 2005: Message edited by: Joel McNary ]
 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct. The database contains '& # 39;' and '& QUOT;', like this:
 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops, my encoded string is being decoded automatically by HTML. I meant, The database contains '& # 39;' and '& QUOT;', like this:

He said:& # 39; I& QUOT;m not like that.& # 39;
reply
    Bookmark Topic Watch Topic
  • New Topic