From 5bf343a179e9565f78903ae63a002522373163a8 Mon Sep 17 00:00:00 2001 From: Gavriel Fleischer Date: Tue, 29 Jan 2019 23:36:01 +0200 Subject: fixed message encoding --- test/org/traccar/protocol/WatchProtocolEncoderTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/org/traccar/protocol') diff --git a/test/org/traccar/protocol/WatchProtocolEncoderTest.java b/test/org/traccar/protocol/WatchProtocolEncoderTest.java index e088a2b04..520d4998c 100644 --- a/test/org/traccar/protocol/WatchProtocolEncoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolEncoderTest.java @@ -43,7 +43,7 @@ public class WatchProtocolEncoderTest extends ProtocolTest { command.setDeviceId(1); command.setType(Command.TYPE_MESSAGE); command.set(Command.KEY_MESSAGE, "text"); - assertEquals("[CS*123456789012345*0010*MESSAGE,74657874]", encoder.encodeCommand(null, command)); + assertEquals("[CS*123456789012345*001c*MESSAGE,feff0074006500780074]", encoder.encodeCommand(null, command)); command = new Command(); command.setDeviceId(1); -- cgit v1.2.3 From 61eb28513bdef0aae9e776f9f872b6c26661556a Mon Sep 17 00:00:00 2001 From: Gavriel Fleischer Date: Wed, 30 Jan 2019 05:48:57 +0200 Subject: removed BOM --- src/org/traccar/protocol/WatchProtocolEncoder.java | 2 +- test/org/traccar/protocol/WatchProtocolEncoderTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test/org/traccar/protocol') diff --git a/src/org/traccar/protocol/WatchProtocolEncoder.java b/src/org/traccar/protocol/WatchProtocolEncoder.java index 12067f354..431b0455a 100644 --- a/src/org/traccar/protocol/WatchProtocolEncoder.java +++ b/src/org/traccar/protocol/WatchProtocolEncoder.java @@ -37,7 +37,7 @@ public class WatchProtocolEncoder extends StringProtocolEncoder implements Strin DecimalFormat fmt = new DecimalFormat("+#.##;-#.##", DecimalFormatSymbols.getInstance(Locale.US)); return fmt.format(offset); } else if (key.equals(Command.KEY_MESSAGE)) { - return DataConverter.printHex(value.toString().getBytes(StandardCharsets.UTF_16)); + return DataConverter.printHex(value.toString().getBytes(StandardCharsets.UTF_16BE)); } return null; diff --git a/test/org/traccar/protocol/WatchProtocolEncoderTest.java b/test/org/traccar/protocol/WatchProtocolEncoderTest.java index 520d4998c..f55086082 100644 --- a/test/org/traccar/protocol/WatchProtocolEncoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolEncoderTest.java @@ -43,7 +43,7 @@ public class WatchProtocolEncoderTest extends ProtocolTest { command.setDeviceId(1); command.setType(Command.TYPE_MESSAGE); command.set(Command.KEY_MESSAGE, "text"); - assertEquals("[CS*123456789012345*001c*MESSAGE,feff0074006500780074]", encoder.encodeCommand(null, command)); + assertEquals("[CS*123456789012345*0018*MESSAGE,0074006500780074]", encoder.encodeCommand(null, command)); command = new Command(); command.setDeviceId(1); -- cgit v1.2.3