fix(log): the grid check let non-ASCII digits through and refused a legal length
Checked against ADIF 3.1.7 (2026-03-22, the current release) rather than my own reading. Two of my rules were wrong. Char.isDigit() is Unicode-aware and covers the whole Nd category - some 600 characters. So Arabic-Indic, Devanagari, Persian and fullwidth digits all passed as a square pair, which a localised keypad produces without the operator seeing any difference. The spec is explicit: "Digit - an ASCII character whose code lies in the range of 48 through 57, inclusive." Wavelog stores GRIDSQUARE verbatim, so such a value would never match a real grid in any statistics or VUCC query - the exact failure this validation exists to prevent. Two-character locators are legal. The GridSquare type is "a case-insensitive 2-character, 4-character, 6-character, or 8-character Maidenhead locator" and the GRIDSQUARE field description repeats all four. My comment claimed Maidenhead had no other lengths, and a test name asserted there was no two-character form. Both were wrong. It is accepted now with a note that a field is accurate to about 1000km - the same treatment four characters already had. That also uncovered a latent crash: the square-pair check read index 2 of a string that may only have two characters. What survived the check: the A-R field range is right, verified by replicating qthToPosition's arithmetic - SS12AA decodes to 92N 182E, past both the pole and the antimeridian, while RR99 is the last cell inside the world. Wavelog's own Qra.php validates with the same range. The subsquare A-X range and digits in positions 7-8 are also correct. On 10 and 12 character locators the spec says store the first 8 in GRIDSQUARE and the rest in GRIDSQUARE_EXT. Neither WavelogQso nor Wavelog's field list carries GRIDSQUARE_EXT, so the extra pair has nowhere to go; the field clips at 8, which produces the spec-correct GRIDSQUARE value. Recorded in a comment rather than pretended to be deliberate. 17 tests now, including the four non-ASCII digit families and the two-character boundary.
This commit is contained in:
1 parent
6c67aa2718
commit
e27d692e8f
5 files changed
+91
-13
No files matched your search
@@ -280,6 +280,7 @@
|
||||
<string name="wavelog_grid_help">对方报给你的网格。留空则从 QRZ 查询。</string>
|
||||
<string name="wavelog_grid_bad">不是有效网格</string>
|
||||
<string name="wavelog_grid_square_only">仅方格 - 精度约 100 公里</string>
|
||||
<string name="wavelog_grid_field_only">仅大方格 - 精度约 1000 公里</string>
|
||||
<string name="wavelog_mode_hint">模式</string>
|
||||
<string name="wavelog_mode_edit">修改模式</string>
|
||||
<string name="wavelog_time_hint">时间</string>
|
||||
|
||||
@@ -311,6 +311,7 @@
|
||||
<string name="wavelog_grid_help">What they sent you. Left empty, it is looked up on QRZ.</string>
|
||||
<string name="wavelog_grid_bad">Not a grid square</string>
|
||||
<string name="wavelog_grid_square_only">Square only - accurate to about 100 km</string>
|
||||
<string name="wavelog_grid_field_only">Field only - accurate to about 1000 km</string>
|
||||
<string name="wavelog_mode_hint">Mode</string>
|
||||
<string name="wavelog_mode_edit">Edit the mode</string>
|
||||
<string name="wavelog_time_hint">Time</string>
|
||||
|
||||
Reference in new issue
Block a user