提交 cb63bf48 authored 作者: Thomas Mueller's avatar Thomas Mueller

The Recover tool did not convert correctly convert CLOB data with non-ASCII characters.

上级 00083108
...@@ -18,7 +18,8 @@ Change Log ...@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>Tools: the method run(String... args) has been renamed to runTool(String... args) <ul><li>The Recover tool did not convert correctly convert CLOB data with non-ASCII characters.
</li><li>Tools: the method run(String... args) has been renamed to runTool(String... args)
so it can't be confused with run(). so it can't be confused with run().
</li><li>Server.startWebServer(Connection) was not working as expected. </li><li>Server.startWebServer(Connection) was not working as expected.
</li><li>The database URL option ACCESS_MODE_LOG is no longer supported. </li><li>The database URL option ACCESS_MODE_LOG is no longer supported.
......
...@@ -140,7 +140,7 @@ public class Recover extends Tool implements DataHandler { ...@@ -140,7 +140,7 @@ public class Recover extends Tool implements DataHandler {
* INTERNAL * INTERNAL
*/ */
public static Reader readClob(String fileName) throws IOException { public static Reader readClob(String fileName) throws IOException {
return new BufferedReader(new InputStreamReader(readBlob(fileName))); return new BufferedReader(new InputStreamReader(readBlob(fileName), "UTF-8"));
} }
/** /**
......
...@@ -310,7 +310,7 @@ public class TestTools extends TestBase { ...@@ -310,7 +310,7 @@ public class TestTools extends TestBase {
stat.execute("create table test(id int primary key, name varchar, b blob, c clob)"); stat.execute("create table test(id int primary key, name varchar, b blob, c clob)");
stat.execute("create table \"test 2\"(id int primary key, name varchar)"); stat.execute("create table \"test 2\"(id int primary key, name varchar)");
stat.execute("comment on table test is ';-)'"); stat.execute("comment on table test is ';-)'");
stat.execute("insert into test values(1, 'Hello', SECURE_RAND(2000), space(2000))"); stat.execute("insert into test values(1, 'Hello', SECURE_RAND(4100), '\u00e4' || space(4100))");
ResultSet rs; ResultSet rs;
rs = stat.executeQuery("select * from test"); rs = stat.executeQuery("select * from test");
rs.next(); rs.next();
...@@ -344,8 +344,9 @@ public class TestTools extends TestBase { ...@@ -344,8 +344,9 @@ public class TestTools extends TestBase {
assertEquals("Hello", rs.getString(2)); assertEquals("Hello", rs.getString(2));
byte[] b2 = rs.getBytes(3); byte[] b2 = rs.getBytes(3);
String s2 = rs.getString(4); String s2 = rs.getString(4);
assertEquals(2000, b2.length); assertEquals("\u00e4 ", s2.substring(0, 2));
assertEquals(2000, s2.length()); assertEquals(4100, b2.length);
assertEquals(4101, s2.length());
assertEquals(b1, b2); assertEquals(b1, b2);
assertEquals(s1, s2); assertEquals(s1, s2);
assertFalse(rs.next()); assertFalse(rs.next());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论