提交 b396a2ca authored 作者: Uncle-pan's avatar Uncle-pan

Bugfix - using default locale encoding issue in build tool, and

conversion between varchar and varbinary value types.
上级 edf9f2d7
...@@ -960,7 +960,10 @@ public abstract class Value { ...@@ -960,7 +960,10 @@ public abstract class Value {
case STRING: { case STRING: {
String s; String s;
if (getType() == BYTES && mode != null && mode.charToBinaryInUtf8) { if (getType() == BYTES && mode != null && mode.charToBinaryInUtf8) {
s = new String(getBytesNoCopy()); // Bugfix - Can't use the locale encoding when enabling charToBinaryInUtf8 in mode.
// The following two target types also are the same issue.
// @since 2018-07-19 little-pan
s = new String(getBytesNoCopy(), StandardCharsets.UTF_8);
} else { } else {
s = getString(); s = getString();
} }
...@@ -969,7 +972,7 @@ public abstract class Value { ...@@ -969,7 +972,7 @@ public abstract class Value {
case STRING_IGNORECASE: { case STRING_IGNORECASE: {
String s; String s;
if (getType() == BYTES && mode != null && mode.charToBinaryInUtf8) { if (getType() == BYTES && mode != null && mode.charToBinaryInUtf8) {
s = new String(getBytesNoCopy()); s = new String(getBytesNoCopy(), StandardCharsets.UTF_8);
} else { } else {
s = getString(); s = getString();
} }
...@@ -978,7 +981,7 @@ public abstract class Value { ...@@ -978,7 +981,7 @@ public abstract class Value {
case STRING_FIXED: { case STRING_FIXED: {
String s; String s;
if (getType() == BYTES && mode != null && mode.charToBinaryInUtf8) { if (getType() == BYTES && mode != null && mode.charToBinaryInUtf8) {
s = new String(getBytesNoCopy()); s = new String(getBytesNoCopy(), StandardCharsets.UTF_8);
} else { } else {
s = getString(); s = getString();
} }
......
...@@ -962,6 +962,24 @@ public class BuildBase { ...@@ -962,6 +962,24 @@ public class BuildBase {
println("Compiling " + files.size() + " classes"); println("Compiling " + files.size() + " classes");
StringList params = new StringList(); StringList params = new StringList();
params.addAll(args); params.addAll(args);
// Bugfix - Use UTF-8 instead of the default locale encoding when compiling,
//because of H2 source file encoding is UTF-8.
// @since 2018-07-19 little-pan
String encoding = null;
for(int i = 0, size = params.size(); i < size; ++i){
if("-encoding".equals(params.get(i))){
encoding = params.get(i + 1);
break;
}
}
if(encoding == null){
encoding = StandardCharsets.UTF_8.name();
params.add("-encoding");
params.add(encoding);
}
println("Using encoding " + encoding);
params.addAll(getPaths(files.keep(".java"))); params.addAll(getPaths(files.keep(".java")));
String[] array = params.array(); String[] array = params.array();
int result; int result;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论