Re: Per field encoding
Posted by: Filipe Silva
Date: May 10, 2024 10:58AM

Fix:

properties.put("characterEncoding", "latin1");
properties.put("clobCharacterEncoding", "utf8");

When sending as a stream of character data you need to send the bytes matching the target encoding.

BTW, in this case it should be enough to just set:

properties.put("characterEncoding", "utf8");

Just mind that sending bytes as UTF-8 you open the door to sending characters that can't be encoded in Latin1 and get errors because of that. Sending as Latin1 will replace all those characters by '?' beforehand and, thus, no errors.

And, remember, character streams must leave the driver matching exactly the character set of the target column.

I tested the above with both MySQL Server 8.4.0 and 5.7.44.

Options: ReplyQuote


Subject
Written By
Posted
May 02, 2024 05:39AM
May 03, 2024 05:02AM
May 03, 2024 06:46AM
May 06, 2024 03:58AM
May 06, 2024 04:23PM
May 10, 2024 07:17AM
Re: Per field encoding
May 10, 2024 10:58AM
May 10, 2024 11:03AM
May 13, 2024 06:51PM
May 13, 2024 11:56PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.