Your message dated Sun, 19 Mar 2017 19:50:28 +0000
with message-id <[email protected]>
and subject line Bug#852721: fixed in tunnelx 20160713-4
has caused the Debian Bug report #852721,
regarding tunnelx: Non-ASCII character corruption
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
852721: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852721
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: tunnelx
Version: 20160713-3
Severity: normal
Tags: patch
Characters outside US-ASCII get corrupted when saving and loading
tunnel sketches. The reason is that each char is simply cast to byte
when saving, and sign-extended to char when loading. I've made a patch
which writes and reads XML numeric character references for characters
not in US-ASCII as declared in the XML declaration. I tested with my
current survey which contains Gaelic names, and hand-edited the XML to
ensure that reading hexadecimal representations works (we always write
decimal). The patch is probably suitable for forwarding upstream.
Perhaps an alternative approach might be considered - open the output
file with UTF-8 encoding, and change the XML declaration to reflect
that.
Index: tunnelx-20160713/src/TNXML.java
===================================================================
--- tunnelx-20160713.orig/src/TNXML.java
+++ tunnelx-20160713/src/TNXML.java
@@ -726,7 +726,7 @@ class TNXML
/////////////////////////////////////////////
static char[] chconvCH = { (char)176, (char)246, (char)252, '<', '>', '"', '&', '\\', '\'', '\n', '\t', ' ' };
static char[] chconv = chconvCH; // allow for hacks (which vary chconvleng)
- static String[] chconvName = {"°", "ö", "ü", "<", ">", """, "&", "&backslash;", "&apostrophe;", "&newline;", "&tab;", "&space;" };
+ static String[] chconvName = {"deg", "ouml", "uuml", "lt", "gt", "quot", "amp", "backslash", "apostrophe", "newline", "tab", "space" };
static int chconvleng = chconvCH.length; // used for hacking out the space ones (this hack needs to be killed, or replaced with a flag)
static int chconvlengWSP = chconvCH.length - 4; // used for hacking out the space ones (this hack needs to be killed, or replaced with a flag)
/////////////////////////////////////////////
@@ -739,16 +739,23 @@ class TNXML
int j;
// there might be a regexp that would do this substitution directly, or use indexOf in a concatenated string of chconvCH
- for (j = 0; j < chconvleng; j++)
+ for (j = 3; j < chconvleng; j++) // start at '<' to allow deg, ouml, and uuml to use the general substitution below
{
if ((ch == chconvCH[j]) && (bAlsoSpace || (ch != ' ')))
{
- sb.append(chconvName[j]);
+ sb.append('&').append(chconvName[j]).append(';');
break;
}
}
- if (j == chconvleng)
- sb.append(ch);
+ if (j == chconvleng) {
+ // not found in table
+ if (' ' <= ch && ch <= 127)
+ // printable ASCII
+ sb.append(ch);
+ else
+ // general Unicode character
+ sb.append("&#").append((int)ch).append(";");
+ }
}
}
@@ -771,31 +778,34 @@ class TNXML
char ch = s.charAt(i);
if (ch == '&')
{
- int j;
- for (j = 0; j < chconvleng; j++)
- {
- if (s.regionMatches(i, chconvName[j], 0, chconvName[j].length()))
- {
- sb.append(chconvCH[j]);
- i += chconvName[j].length() - 1;
- //if (j < 2)
- // System.out.println(chconv[j] + " -- " + (int)chconv[j].toCharArray()[0]);
- break;
- }
- }
- if (j == chconvleng)
- {
- if (s.regionMatches(i, "&space;", 0, 7)) // back-compatible
- {
- sb.append(" ");
- i += 6;
- }
+ int refc = s.indexOf(';', i);
+ if (refc < 0)
+ TN.emitError("Missing reference close at " + s.substring(i, Math.max(i+15, s.length())));
+
+ if (s.charAt(++i) == '#') {
+ // A malformed numeric character reference will result in NumberFormatException
+ if (s.charAt(++i) == 'x')
+ // hexadecimal
+ sb.append((char)Integer.parseInt(s.substring(++i, refc), 16));
else
+ // decimal
+ sb.append((char)Integer.parseInt(s.substring(i, refc), 10));
+ } else {
+ String name = s.substring(i, refc);
+ int j;
+ for (j = 0; j < chconvleng; j++)
{
- System.out.println(s.substring(i));
- TN.emitError("unable to resolve & from pos " + i + " in string:" + s);
+ if (name.equals(chconvName[j]))
+ {
+ sb.append(chconvCH[j]);
+ break;
+ }
}
+ if (j == chconvleng)
+ TN.emitError("unable to resolve entity " + name);
}
+ // advance to the reference-close character (loop increment will skip it)
+ i = refc;
}
else
sb.append(ch);
-- System Information:
Debian Release: 9.0
APT prefers testing
APT policy: (900, 'testing'), (900, 'stable'), (400, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armel
Kernel: Linux 3.16.7-ckt2-balti (SMP w/8 CPU cores; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages tunnelx depends on:
ii default-jre [java8-runtime] 2:1.8-58
ii gcj-4.8-jre [java5-runtime] 4.8.5-4
ii jarwrapper 0.59
ii openjdk-8-jre [java8-runtime] 8u111-b14-3
tunnelx recommends no packages.
tunnelx suggests no packages.
-- no debconf information
--- End Message ---
--- Begin Message ---
Source: tunnelx
Source-Version: 20160713-4
We believe that the bug you reported is fixed in the latest version of
tunnelx, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Wookey <[email protected]> (supplier of updated tunnelx package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Sun, 12 Mar 2017 23:32:37 +0000
Source: tunnelx
Binary: tunnelx
Architecture: source all
Version: 20160713-4
Distribution: experimental
Urgency: medium
Maintainer: Wookey <[email protected]>
Changed-By: Wookey <[email protected]>
Description:
tunnelx - Cave Survey drawing software
Closes: 852718 852720 852721
Changes:
tunnelx (20160713-4) experimental; urgency=medium
.
[Toby Speight]
* Allow scaled units (Closes: #852718)
* Make estimed walls appear dashed (Closes: #852720)
* Allow save/load of non-ascii chars (Closes: #852721)
* Update freesteel wiki URL, pending tunnelx-doc package
Checksums-Sha1:
8315b0255597084ff1ab8c5277d79ae0dd0febf5 1893 tunnelx_20160713-4.dsc
9e73a2f2362a67115aacc4bc6a508e926910d2a6 16400 tunnelx_20160713-4.debian.tar.xz
5b92fbc9b7ff36de3d8a502a61e6c986352c3366 628902 tunnelx_20160713-4_all.deb
3aef8cacf7dba2b1e09c954d26551bb314c5b543 9618
tunnelx_20160713-4_amd64.buildinfo
Checksums-Sha256:
5988b3c66a8a36c634549be6e47b57472897fa7bde9fc8cc90c19abe1d88864d 1893
tunnelx_20160713-4.dsc
f497207b2ebdd594387a37f12c66363cbd97f91ee97f8ca5f80b27fbb1e23301 16400
tunnelx_20160713-4.debian.tar.xz
a8d78f7d872da6f60df3d2f41df2b6bfca2200e9a8379c14bb25be96d0ae586c 628902
tunnelx_20160713-4_all.deb
374889e8e7dfd7ed5851172d4fdca71db887d468e4eb1eb3b87dbf1a651456f0 9618
tunnelx_20160713-4_amd64.buildinfo
Files:
61da1744f429b013125f33be49a8624e 1893 science extra tunnelx_20160713-4.dsc
8728b6cc70e2b866a2b22a2da7adc1ad 16400 science extra
tunnelx_20160713-4.debian.tar.xz
f851c07f3c016a8181fe235eced8774e 628902 science extra
tunnelx_20160713-4_all.deb
8d0d07ec67ccdd06c3b8862f95bfc594 9618 science extra
tunnelx_20160713-4_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBCAAGBQJYzt1RAAoJEPuGMlGob55HJ7UQAJ8QojcKjIS4K5H24dgI/0Be
UVoxEQ7lZfdsizN+t/dfrFYxW19shk22lIRmHMM6+4raFPOyRrsCw/caHktgxi3W
YScRmL6WF0HLO0zLNqMep4T5I8np7Z2nNCu/fYzfANdF8pm8v7nEZKheuQdIRib0
xsjvotzdNEo7m7NnuqS5i5+uNr0LMlbt82UhG5lVDUsNlZG2A7R4DvWAgCquCHIr
v01Q6Ts65EesxW4KHmCf83edPMPHI/c37BYI49YM9Bm7lNiorJhjXPV8AEpWDhYc
wJy4SyJnVUn04IH18505fl+i05qxwxpxH4+28S1y9opRatRXDLnK3cx7D1uG8cD+
O0s1uqzX0smQkoT+ganaY3Hsco4I8GlvFAXM21vOPgl0Angh9oMF8v426ukgeWsJ
XIA3xw3F4LxnmuWUkoKUlNw1U+wFFQiJyZaBtH19/C6PIWTsuQvi7ZIxHwKj6VCH
L4+i4Ka8LxdVOQ1kvZ0erJXRlX+/rm0cyTUCsTgUYaAcv9Zl5IXLHWZcdUhDHeNi
G+hyfdW+QxOhkUUCw75OloR9TfWa5GbYfX71yRx9DSTWOuxWhOkEVsjrtoY5lTCI
YkLCh+vkaFMJEkPvUHtgsblj8uyR2MRSM5gKhmNa4XasNibEW8XBOBhZf7B26Dxi
dn/2SUYIhfBlg/4NHGfZ
=0KtI
-----END PGP SIGNATURE-----
--- End Message ---