I am developing a web service that is invoked by an application external to mine. In this web service I receive an XML with all the necessary parameters to offer the service. The issue is that the XML comes with UTF-8 encoding and the database where the information is stored is in Latin 1 (ISO-8859-1). How can I convert the XML to Latin 1 encoding? Either the full XML or the attributes once extracted. I have a Java class that implements the object that is received.
Example: I have the object visita
and it has an attribute that is visita.getComentarioS()
. To get the object from the XML I do the following:
XmlVisita visita = (XmlVisita ) context.getParameter("xmlVisita");
where context is an object of type EventHandlerContext
. When storing the comment of the visit in the database, if it contains special characters, it is stored badly since the database is in Latin 1.