Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly unicode output in platform/mission values #224

Open
dbussert opened this issue Aug 29, 2020 · 5 comments
Open

Possibly unicode output in platform/mission values #224

dbussert opened this issue Aug 29, 2020 · 5 comments

Comments

@dbussert
Copy link

dbussert commented Aug 29, 2020

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.

@bradh
Copy link
Collaborator

bradh commented Aug 29, 2020

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?

@dbussert
Copy link
Author

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

@bradh
Copy link
Collaborator

bradh commented Aug 30, 2020

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
Copy link
Collaborator

bradh commented Sep 2, 2020

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

@dbussert
Copy link
Author

dbussert commented Sep 3, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants