ColumnCast.java bytes类型转换为string出现乱码?
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 5.7k
- PR merge metrics
- No merged PRs in 30d
Description
在取mysql中的blob数据写到txt文件中,以utf-8编码写入出现字节大于0x7F的数据在文件中显示乱码,其它编码写入也是不能还原原文件
class BytesCast {
static String encoding = "utf-8";
static void init(final Configuration configuration) {
BytesCast.encoding = configuration.getString("common.column.encoding",
BytesCast.encoding);
return;
}
static String asString(final BytesColumn column)
throws UnsupportedEncodingException {
if (null == column.asBytes()) {
return null;
}
return new String(column.asBytes(), encoding);
}
}
貌似这句话出错 return new String(column.asBytes(), encoding)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the BytesCast.asString method shown in the issue and trace how common.column.encoding is initialized and how the resulting string is written to the TXT output. Reproduce the case with MySQL BLOB data containing bytes above 0x7F, then determine the expected encoding and verify that the output can restore the original data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mysql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100