0

I have a program, in which a table is shown on the screen. The content is displayed correctly as long as there are no accents.

This is my code

StringBuffer sBuff = new StringBuffer();
if(!("CSV".equalsIgnoreCase(exportFormat) || "HTML".equalsIgnoreCase(exportFormat))){
        sBuff.append("<p title=\""+displayparseado+"\">");
        sBuff.append(displayparseado);
        sBuff.append("</p>");
}
else{
        sBuff.append(display);
}

I have also tried parsing the string.

byte arr[] = display.getBytes("UTF-8");
String displayparseado = new String(arr);

Expected output: Descripción de prueba.

Actual output:

enter image description here

A note; I can not use external libraries.

icortazar
  • 110
  • 1
  • 15

1 Answers1

1

Try StringEscapeUtils to escape your String for html. This did a good job for me till now.

heiwil
  • 612
  • 4
  • 8