A small part of our application allows users to connect a LS300 or a Raven XE to send SMS messages. We use the following code to build the outgoing message:
private String buildPayload(String to, String message) {
try {
String hexBody = DatatypeConverter.printHexBinary(message.getBytes("US-ASCII"));
return String.format("<<<%s,ASCII,%d,%s>>>", to, message.length(), hexBody);
} catch (UnsupportedEncodingException e) {
log.warn("Message cannot be encoded for SMS: " + e.getMessage());
return "";
}
}
which gets called via byte[] bs = buildPayload(to, message).getBytes(“US-ASCII”); and sent to the Airlink using DatagramPacket and DatagramSocket.
The above code works great, but only allows ASCII messages. If we try to change buildPayload to use getBytes(“UTF-8”) and String.format("<<<%s,8-bit,%d,%s>>>", to, message.length(), hexBody); or String.format("<<<%s,Unicode,%d,%s>>>", to, message.length(), hexBody); we get ACK203ACK which is “Parse Error on field #3 (Data type and separator)”.
I sent a message to tech support a week ago with no response. Anyone have a pointer on how to build a message that allows non-ASCII characters?