Update of /cvsroot/monetdb/clients/src/java/src/nl/cwi/monetdb/mcl/net
In directory 
sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27756/src/nl/cwi/monetdb/mcl/net

Modified Files:
      Tag: Clients_1-20
        MapiSocket.java 
Log Message:
Fix an encoding bug.

We didn't encode to and decode from the server as UTF-8.  As a result,
the server could receive non-UTF-8 byte sequences, resulting in the SQL
case the message !unexpected end of input.

We now properly encode whatever we have to UTF-8.

This in particularly is a problem on Windows.  This check-in does NOT
fix a problem with Windows, as there is still a charset problem.
Windows users can now store and recall "weird" characters, but in the
database, these are not stored as the character the windows user sees.
This is due to Windows exporting locale = cp1252 to console
applications, whereas in reality it uses locale cp743 (DOS).  This
guarantees a mismatch.



Index: MapiSocket.java
===================================================================
RCS file: 
/cvsroot/monetdb/clients/src/java/src/nl/cwi/monetdb/mcl/net/Attic/MapiSocket.java,v
retrieving revision 1.9.2.4
retrieving revision 1.9.2.5
diff -u -d -r1.9.2.4 -r1.9.2.5
--- MapiSocket.java     22 Nov 2007 22:26:05 -0000      1.9.2.4
+++ MapiSocket.java     4 Dec 2007 12:25:17 -0000       1.9.2.5
@@ -211,8 +211,12 @@
 
                fromMonet = new BlockInputStream(con.getInputStream());
                toMonet = new BlockOutputStream(con.getOutputStream());
-               reader = new BufferedMCLReader(fromMonet);
-               writer = new BufferedMCLWriter(toMonet);
+               try {
+                       reader = new BufferedMCLReader(fromMonet, "UTF-8");
+                       writer = new BufferedMCLWriter(toMonet, "UTF-8");
+               } catch (UnsupportedEncodingException e) {
+                       throw new AssertionError(e.toString());
+               }
                writer.registerReader(reader);
 
                // do the login ritual, read challenge, send response


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to