snichol 2003/06/12 23:42:12
Modified: java/src/org/apache/soap/util/mime MimeUtils.java
Log:
When generating a unique value for a cid, force the host name used to be
ASCII characters. That way, URL encode/decode will agree on client and
server regardless of the default character encoding for the platforms.
Revision Changes Path
1.8 +9 -0 xml-soap/java/src/org/apache/soap/util/mime/MimeUtils.java
Index: MimeUtils.java
===================================================================
RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/mime/MimeUtils.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MimeUtils.java 13 Jun 2003 06:23:02 -0000 1.7
+++ MimeUtils.java 13 Jun 2003 06:42:12 -0000 1.8
@@ -85,6 +85,15 @@
String host = null;
try {
host = InetAddress.getLocalHost().getHostName();
+ // Force host to all ASCII if it is not already
+ for (int i = 0; i < host.length(); i++) {
+ if ((host.charAt(i) & 0xff80) != 0) {
+ StringBuffer h = new StringBuffer(host.length());
+ for (int j = 0; j < host.length(); j++)
+ h.append((host.charAt(j) & 0x007f) | 0x0020);
+ host = h.toString();
+ }
+ }
} catch (UnknownHostException uhe) {
host = "localhost";
}