OSDN Git Service
(root)
/
kde
/
Katie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
30c7c11
)
remove BOMs if QTextCodec::ConverterState has QTextCodec::IgnoreHeader flag set
author
Ivailo Monev
<xakepa10@laimg.moc>
Mon, 13 Jan 2020 00:54:16 +0000
(
00:54
+0000)
committer
Ivailo Monev
<xakepa10@laimg.moc>
Mon, 13 Jan 2020 01:25:49 +0000
(
01:25
+0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/codecs/qicucodec.cpp
patch
|
blob
|
history
diff --git
a/src/core/codecs/qicucodec.cpp
b/src/core/codecs/qicucodec.cpp
index
100ffcb
..
88abc4d
100644
(file)
--- a/
src/core/codecs/qicucodec.cpp
+++ b/
src/core/codecs/qicucodec.cpp
@@
-983,6
+983,14
@@
QString QIcuCodec::convertToUnicode(const char *src, int length,
}
} else {
result.resize(convresult);
+ if (state && state->flags & QTextCodec::IgnoreHeader) {
+ // ICU always generates BOMs so no checks
+ if (ucnv_compareNames(m_name.constData(), "UTF-32")) {
+ result.remove(0, 4);
+ } else if (ucnv_compareNames(m_name.constData(), "UTF-16")) {
+ result.remove(0, 2);
+ }
+ }
}
if (!state)