[gnote] Fix XmlReader loading unicode files
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Fix XmlReader loading unicode files
- Date: Sat, 28 Jan 2017 21:44:43 +0000 (UTC)
commit 61e1dee51f6d7300651a88fd22e32f4eb60bced5
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat Jan 28 23:20:43 2017 +0200
Fix XmlReader loading unicode files
src/sharp/xmlreader.cpp | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/src/sharp/xmlreader.cpp b/src/sharp/xmlreader.cpp
index 97f467d..2a7c3a6 100644
--- a/src/sharp/xmlreader.cpp
+++ b/src/sharp/xmlreader.cpp
@@ -81,11 +81,9 @@ namespace sharp {
void XmlReader::load_buffer(const Glib::ustring &s)
{
close();
- /** we copy the string. It shouldn't be a big deal as the strings
- * are copy on write.
- */
m_buffer = s;
- m_reader = xmlReaderForMemory(m_buffer.c_str(), m_buffer.size(), "",
+ // use bytes() instead of size(), because of multibyte Unicode characters (need proper C-string length
+ m_reader = xmlReaderForMemory(m_buffer.c_str(), m_buffer.bytes(), "",
"UTF-8", 0);//XML_PARSE_RECOVER);
m_error = (m_reader == NULL);
if(m_reader) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]