jmisb icon indicating copy to clipboard operation
jmisb copied to clipboard

Possibly unicode output in platform/mission values

Open dbussert opened this issue 5 years ago • 5 comments

I found this output in some files I tested with jmisb_example, and I noticed because a JSON parser failed to read the value

"PlatformDesignation": "^^�^H^@^@^@^@^BU�^A^@�^A^A�^D^@^@^@^@�^D^@^@^@^@�^D^@^@^@^@�^H^@^Ek=^\��"
"MissionId": "^N�^H^@^@^@^@^@\�^?�^A^@�^A^A�^D^@^@^@^@�^D^@^@^@^@�^D^@^@^@^@�^H^@^Ek=^^���"

I think it's unicode, but I'm not entirely sure what it is. The whole file parses fine otherwise.

dbussert avatar Aug 29 '20 19:08 dbussert

Doesn't really look like UTF-16. Are those the only two values you see it in?

Also, can you say what the ST0601 Version is reported as for this file?

bradh avatar Aug 29 '20 23:08 bradh

I'll have to check next week, I didn't write down the file name and now I'm not sure how to replicate

dbussert avatar Aug 30 '20 02:08 dbussert

Can you (manually, if necessary) apply these changes and show a small example of the result?

diff --git a/api/src/main/java/org/jmisb/api/klv/st0601/UasDatalinkFactory.java b/api/src/main/java/org/jmisb/api/klv/st0601/UasDatalinkFactory.java
index 02a4c35..8cc8251 100644
--- a/api/src/main/java/org/jmisb/api/klv/st0601/UasDatalinkFactory.java
+++ b/api/src/main/java/org/jmisb/api/klv/st0601/UasDatalinkFactory.java
@@ -1,6 +1,7 @@
 package org.jmisb.api.klv.st0601;
 
 import org.jmisb.api.common.KlvParseException;
+import org.jmisb.core.klv.ArrayUtils;
 
 /** Dynamically create {@link IUasDatalinkValue}s from {@link UasDatalinkTag}s. */
 public class UasDatalinkFactory {
@@ -25,6 +26,7 @@ public class UasDatalinkFactory {
             case PrecisionTimeStamp:
                 return new PrecisionTimeStamp(bytes);
             case MissionId:
+                System.out.println("MissionId bytes[]: " + ArrayUtils.toHexString(bytes, 16, true));
                 return new UasDatalinkString(UasDatalinkString.MISSION_ID, bytes);
             case PlatformTailNumber:
                 return new UasDatalinkString(UasDatalinkString.PLATFORM_TAIL_NUMBER, bytes);
@@ -39,6 +41,7 @@ public class UasDatalinkFactory {
             case PlatformIndicatedAirspeed:
                 return new PlatformIndicatedAirspeed(bytes);
             case PlatformDesignation:
+                System.out.println("PlatformDesignation bytes[]: " + ArrayUtils.toHexString(bytes, 16, true));
                 return new UasDatalinkString(UasDatalinkString.PLATFORM_DESIGNATION, bytes);
             case ImageSourceSensor:
                 return new UasDatalinkString(UasDatalinkString.IMAGE_SOURCE_SENSOR, bytes);

(Hopefully you're familiar with the syntax. If not you add the three lines that are marked with + to api/src/main/java/org/jmisb/api/klv/st0601/UasDatalinkFactory.java and do a rebuild.)

bradh avatar Aug 30 '20 04:08 bradh

@dbussert Did you have a chance to look at this?

bradh avatar Sep 02 '20 22:09 bradh

Unfortunately I cannot find the file that caused this in the first place. I saw it on one pared output, but I moved on and can't replicate again. I might have to reopen if I come across it again

dbussert avatar Sep 03 '20 00:09 dbussert