0

I need to replace special characters with their respective encoding from the list, below are the sample list of characters and their encoding

  'Á' => 'Á', 
  'á' => 'á', 
  'Â' => 'Â', 
  'â' => 'â', 
  '´' => '´', 
  'Æ' => 'Æ', 
  'æ' => 'æ', 
  'À' => 'À', 
  'à' => 'à', 
  'ℵ' => 'ℵ', 
  'Α' => 'Α', 
  'α' => 'α', 
  '&' => '&', 
  '∧' => '∧', 

Source String = "this is some sample à for character encoding æ"

After replace character in string should look like below:

output= "this is some sample &aacute for character encoding æ"

  • [Duplicate ?](https://stackoverflow.com/a/10978284/6730571) – Hugues M. Jun 21 '17 at 17:50
  • @Reimeus i don't this is duplicate? – YCF_L Jun 21 '17 at 17:53
  • i'm voting to reopen this question as not duplicate – YCF_L Jun 21 '17 at 17:55
  • @YCF_L yes it is. did you see the answer about `StringEscapeUtils.escapeHtml`? – Reimeus Jun 21 '17 at 17:55
  • @Reimeus how it will be duplicate, can you share the link for the solution ? – pankaj desai Jun 21 '17 at 17:55
  • @Reimeus this is not about Html, it is about some special characters – YCF_L Jun 21 '17 at 17:56
  • @pankajdesai study the javadoc from the best answer, it does exactly what you want – Reimeus Jun 21 '17 at 17:58
  • @Reimeus there will be some custom codes as well in the list, it is not limited to html code. – pankaj desai Jun 21 '17 at 18:00
  • @Reimeus Thanks will look into StringEscapeUtils as well but I hope you able to understand the problem statement – pankaj desai Jun 21 '17 at 18:02
  • "HTML" does not appear in the question, but the "encoding" that is requested *is* [HTML entities](https://developer.mozilla.org/en-US/docs/Glossary/Entity), and the question is the same as "how to convert those characters to HTML entities", and the duplicate answers that already.-- But maybe the answer deserves an update, I'll see what I can do about that. – Hugues M. Jun 22 '17 at 08:09

0 Answers0