0

I have a string in groovy which has accent characters. I need to read this value as it is including the accent characters. Currently, the accent character is getting converted to a 'é'.

I tried to use StringUtils.stripAccents. It converts the accent character to "é".

String input = StringUtils.stripAccents("Gendé");

I expect to get "Gendé" but get "Gendé"

tkruse
  • 10,222
  • 7
  • 53
  • 80
Neha
  • 1
  • 1
    your problem is not clear. if `StringUtils.stripAccents` method returns wrong result - then do not use it. – daggett Jul 16 '19 at 19:11
  • The output "Gendé" looks mire like an encoding problem unrelated to groovy or stripAccents, see https://stackoverflow.com/questions/4325952/%C3%A9-becomes-195169-and-then-becomes-%C3%83-how-do-i-fix-this-encoding-issue. Basically the String is already "Gendé" before stripAccents() is called, and stripAccents leaves it unchanged. You need to set the encoding of your source. – tkruse Jul 17 '19 at 05:26
  • 2
    Possible duplicate of [é becomes &195;#169 and then becomes é How do I fix this encoding issue?](https://stackoverflow.com/questions/4325952/%c3%a9-becomes-195169-and-then-becomes-%c3%83-how-do-i-fix-this-encoding-issue) – tkruse Jul 17 '19 at 05:27
  • If the related question does not help, you need to explain more of your setup and code. Which IDE are you using, where does the String "Gendé" come from, what tool are you running where you see the output? – tkruse Jul 17 '19 at 08:54

0 Answers0