Bug #1089 » 0001-strip_ucs_only_if_size_bigger_equals_two.patch
src/tags.cpp (working copy) | ||
---|---|---|
2321 | 2321 |
DataBuf buf(value.size()); |
2322 | 2322 |
value.copy(buf.pData_, invalidByteOrder); |
2323 | 2323 |
// Strip trailing UCS-2 0-character, if there is one |
2324 |
if (buf.pData_[buf.size_ - 1] == 0 && buf.pData_[buf.size_ - 2] == 0) buf.size_ -= 2; |
|
2324 |
if (buf.size_ >= 2 && |
|
2325 |
buf.pData_[buf.size_ - 1] == 0 && |
|
2326 |
buf.pData_[buf.size_ - 2] == 0) { |
|
2327 |
buf.size_ -= 2; |
|
2328 |
} |
|
2325 | 2329 |
std::string str((const char*)buf.pData_, buf.size_); |
2326 | 2330 |
cnv = convertStringCharset(str, "UCS-2LE", "UTF-8"); |
2327 | 2331 |
if (cnv) os << str; |