From 75421054f92497a4a8f7466eefa4c30684206ac2 Mon Sep 17 00:00:00 2001 From: Matthew Chambers Date: Mon, 27 Sep 2021 18:00:48 +0000 Subject: [PATCH] Treat adif record values as byte length vs string length --- debian/changelog | 7 +++---- package.nw/lib/adif.js | 8 ++++---- package.nw/package.json | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6874c3b..4207670 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,8 @@ -gridtracker (1.21.0917) unstable; urgency=medium +gridtracker (1.21.0926) unstable; urgency=low [Bug Fixes] - - Fixes issues with fetching from LoTW - - -- Matthew Chambers Fri, 16 Sept 2021 01:34:49 -0000 + - This is a test beta to test treating adif records as byte length vs string length + -- Matthew Chambers Sund, 26 Sept 2021 19:03:30 -0000 gridtracker (1.21.0620) unstable; urgency=medium [Bug Fixes] - Fix pulling down of LoTW logs at start-up with a differential log syncing mechanism that only get's changes since last sync, also cool down timer to prevent rapid reloading of LoTW log. diff --git a/package.nw/lib/adif.js b/package.nw/lib/adif.js index 25ec277..db3180c 100644 --- a/package.nw/lib/adif.js +++ b/package.nw/lib/adif.js @@ -1638,7 +1638,7 @@ function sendTcpMessage(msg, length, port, address) client.setTimeout(30000); client.connect(port, address, function () { - client.write(msg); + client.write(Buffer.from(msg, "utf-8")); }); client.on("close", function () {}); @@ -1647,7 +1647,7 @@ function sendTcpMessage(msg, length, port, address) function valueToAdiField(field, value) { var adi = "<" + field + ":"; - adi += String(value).length + ">"; + adi += Buffer.byteLength(String(value)) + ">"; adi += String(value) + " "; return adi; } @@ -1927,7 +1927,7 @@ function finishSendingReport(record, localMode) for (let key in record) { - report += "<" + key + ":" + record[key].length + ">" + record[key] + " "; + report += "<" + key + ":" + Buffer.byteLength(record[key]) + ">" + record[key] + " "; } report += ""; @@ -2109,7 +2109,7 @@ function finishSendingReport(record, localMode) for (var key in record) { report += - "<" + key + ":" + record[key].length + ">" + record[key] + " "; + "<" + key + ":" + Buffer.byteLength(record[key]) + ">" + record[key] + " "; } report += ""; } diff --git a/package.nw/package.json b/package.nw/package.json index 58e642d..8ed545a 100644 --- a/package.nw/package.json +++ b/package.nw/package.json @@ -1,8 +1,8 @@ { "name": "GridTracker", "product_string_do_not_use": "gridtracker", - "version": "1.21.0917", - "betaVersion": "LoTW Fetch Fix 1", + "version": "1.21.0926", + "betaVersion": "utf8", "description": "GridTracker, an amateur radio companion", "author": "Stephen Loomis (N0TTL) and GridTracker.org", "license": "BSD-3-Clause",