diff --git a/code/irrXMLWrapper.h b/code/irrXMLWrapper.h index f5e9c3059..569347e2b 100644 --- a/code/irrXMLWrapper.h +++ b/code/irrXMLWrapper.h @@ -81,12 +81,22 @@ public: // Map the buffer into memory and convert it to UTF8. IrrXML provides its // own conversion, which is merely a cast from uintNN_t to uint8_t. Thus, // it is not suitable for our purposes and we have to do it BEFORE IrrXML - // gets the buffer. Sadly, this forces as to map the whole file into + // gets the buffer. Sadly, this forces us to map the whole file into // memory. data.resize(stream->FileSize()); stream->Read(&data[0],data.size(),1); + // Remove null characters from the input sequence otherwise the parsing will utterly fail + unsigned int size = 0; + unsigned int size_max = data.size(); + for(unsigned int i = 0; i < size_max; i++) { + if(data[i] != '\0') { + data[size++] = data[i]; + } + } + data.resize(size); + BaseImporter::ConvertToUTF8(data); } diff --git a/contrib/irrXML/CXMLReaderImpl.h b/contrib/irrXML/CXMLReaderImpl.h index 6c3afb89c..d2472b28b 100644 --- a/contrib/irrXML/CXMLReaderImpl.h +++ b/contrib/irrXML/CXMLReaderImpl.h @@ -215,7 +215,7 @@ private: { char_type* start = P; - // more forward until '<' found + // move forward until '<' found while(*P != L'<' && *P) ++P;