Bug #879 | PreparedStatement.setString() incorrectly processes GBK string | ||
---|---|---|---|
Submitted: | 20 Jul 2003 17:57 | Modified: | 5 Mar 2004 14:25 |
Reporter: | [ name withheld ] | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S1 (Critical) |
Version: | 3.0.8-stable | OS: | Linux (linux) |
Assigned to: | Mark Matthews | CPU Architecture: | Any |
[20 Jul 2003 17:57]
[ name withheld ]
[29 Jul 2003 7:42]
[ name withheld ]
I am having the same problem of having escape character duplicatted when using preparedstatement. My personnel opinion is that it should have something to do with StringUtils.java:Line180, consider a string with big5 encoding but contains only english character. That line will make all escape character in the string duplicated, but I think think its a preferred behavior. Below is my test case: Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?useUnicode=true&characterEncoding=big5", "", ""); //Statement stmt = conn.createStatement(); PreparedStatement stmt = conn.prepareStatement("insert into TestTable (TestCol) values (?)"); stmt.setString(1, "1234\\1234\\1234\n"); stmt.execute(); If I change characterEncoding to others like gb2312, then the result will be correct.
[7 Aug 2003 15:08]
Mark Matthews
This is fixed in the tree for 3.0.x and 3.1.x. If you can't wait for the release of 3.0.9 or 3.1.1, you can test a nightly snapshot of either after 00:00 GMT on August 9, 2003 from http://mmmysql.sourceforge.net/snapshots/ Thank you for your bug report, and for using MySQL! -Mark
[13 Jan 2004 13:59]
Mark Matthews
I'm re-opening this. To do it totally correct requires some heavy lifting that will have to wait until 3.0.11.
[5 Mar 2004 14:25]
Mark Matthews
This should be fixed in the nightly builds of 3.0 and 3.1.