I am pulling data from an oracle database and inserting it into another oracle database using JDBC adapter services.
Some of the fields that I am pulling from the source database have Unicode characters. Is it possible to convert these characters to ASCII characters? Is there a built-in service to achieve this?
When moving between a string and a byte array (via stringToBytes or bytesToString) you specify the encoding to use in the byte array. E.g. for stringToBytes you indicate what encoding is desired for the resulting byte array. For the other direction, you specify what encoding the byte array uses so that it can be properly interpreted.
Whether or not a Unicode character has an ASCII equivalent depends upon the specific character and the mapping that Java does for the different encodings.
How are you checking that the “data still looks the same?” Can you provide more detail about the steps you’re performing?
I am pulling the data (in unicode) as a string from the database using a select adapter service. I then use stringToBytes with ASCII as the encoding and then use bytesToString with encoding as ASCII to convert it back to a string and then insert it into the database via a batch insert adapter service.
After converting the required fields into ascii and pushing to the target database, I look at the data in the target database. The data is still the same and has not been converted into ASCII (I used a unicode to ASCII converter online to see the ASCII equivalent characters for the unicode characters)