I have a Blackberry project that I'm working on, and I need to convert byte arrays of strings encoded using UTF-16LE (little endian) to a byte array of strings encoded in UTF-16BE (big endian) and visible the other way around. The server I'm connecting to sends BlackBerry byte arrays in UTF-16LE encoding, but the device does not support UTF-16LE. When I try to decode byte arrays back to strings, strings are illegible. However, the device supports UTF-16BE. I also need to reverse this process, that is, convert the array of bytes of the UTF-16BE encoded string to what the server expects (UTF-16LE). Thanks.
I can not do this on the device:
String test = "test"; byte[] testBytes = test.getBytes("UTF-16LE");
I can do this:
String test = "test"; byte[] testBytes = test.getBytes("UTF-16BE");
source share