fix charset convert core

This commit is contained in:
bf0
2021-08-11 18:55:42 +08:00
committed by wangzelin.wzl
parent 0192a4d228
commit 54e159cae4

View File

@ -2250,15 +2250,13 @@ int ObCharset::charset_convert(ObIAllocator& alloc, const ObString& in, const Ob
if (OB_ISNULL(res_buf)) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_WARN("alloc memory failed", K(ret));
} else if (OB_FAIL(
charset_convert(src_cs_type, in.ptr(), in.length(), dst_cs_type, res_buf, res_buf_len, res_len))) {
} else {
if (OB_SUCC(charset_convert(src_cs_type, in.ptr(), in.length(), dst_cs_type, res_buf, res_buf_len, res_len))) {
out.assign_ptr(res_buf, res_len);
}
} else {
// handle replace unknown character
if (OB_FAIL(ret)) {
LOG_WARN("convert charset failed", K(ret), K(in), K(src_cs_type), K(dst_cs_type), KPHEX(in.ptr(), in.length()));
LOG_WARN(
"convert charset failed", K(ret), K(in), K(src_cs_type), K(dst_cs_type), KPHEX(in.ptr(), in.length()));
if (!!(convert_flag & REPLACE_UNKNOWN_CHARACTER)) {
int32_t in_offset = 0;
int64_t res_buf_offset = 0;
@ -2292,6 +2290,7 @@ int ObCharset::charset_convert(ObIAllocator& alloc, const ObString& in, const Ob
}
}
}
}
return ret;
}