Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to do character decoding of accented characters in java

 
Naga venkateswara Rao
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to convert the french characters to html entity codes i.e. from céréales to 'c&e acute;r&e acute;ales' (no space actually between e and a) using any method in java. I tried this method but doesnot know what is going wrong.



I'm calling this method with inputs as and only getting output as
Céréales or
Céréales


Can someone help me?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15715
73
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like your browser is using the wrong character encoding (maybe UTF-8) to display the text. Does the HTML page that is generated include a tag or header that specifies the character set? Make sure that it matches with the actual character encoding that is used for text on the page.

Note: This looks weird:

But that's not your fault; that's a problem in the forum software here, which has a problem with translating sequences such as & lt; and & gt;.
 
Campbell Ritchie
Marshal
Posts: 52664
121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To print < you write < and to print < you write <


That looks recursively ampersandic
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!