... everything works correctly except a search engine ...
If you add the property -Dclient.encoding.override=UTF-8
, you are telling WebSphere what encoding to use (only when this not is specified, eg: 'application/x-www-form-urlencoded; charset=UTF-8'
) to read the parameters of the content of a request POST
or the parameters in a query string . Different from -Dfile.encoding=UTF-8
, which will change the default encoding used when reading or writing files, etc.
If before specifying this property, the search engine did not work correctly, that could mean that the search engine sent the data encoded in UTF-8, but WebSphere decoded it using ISO-8859-1.
For example, the word IBAÑEZ
can be sent as IBA%C3%91EZ
(UTF-8) or IBA%D1EZ
(ISO-8859-1). If the server receives IBA%C3%91EZ
(UTF-8), then WebSphere could decode it in UTF-8 as IBAÑEZ
( IBA\u00D1EZ
) ✔ or ISO-8859-1 as IBAÃEZ
( IBA\u00C3\u0091EZ
) ✘.
... however, when selecting data with accents and trying to press an update or query button in relation to that data, it takes me to the generic error window since the data with the tilde collects them as unrecognizable ...
Assuming that all worked correctly before adding the property -Dclient.encoding.override=UTF-8
, then that means that it is decoding with UTF-8 the data received as ISO-8859-1 . That is, if WebSphere receives IBA%D1EZ
(ISO-8859-1), it now decodes it in UTF-8 as IBA�EZ
( IBA\uFFFDEZ
) ✘.
You must make sure that the data is sent as UTF-8. If you have forms that are sent without AJAX, then add the accept-charset
attribute. It is is:
<form … accept-charset="UTF-8" … >
With JavaScript, use the function encodeURI()
or encodeURIComponent()
(depending on the case) to encode the data to be sent in UTF-8 with AJAX. jQuery uses UTF-8 to encode objects (eg: { nombre: var2 }
) in data
.
In case you change the header of the JSPs to UTF-8
(also changing the encoding of the file itself), the above may be optional in most browsers, except possibly in Internet Explorer .