fix xml utf8 detection

Origin commit data
------------------
Branch: ni/coolstream
Commit: 08b8505da6
Author: TangoCash <eric@loxat.de>
Date: 2018-10-27 (Sat, 27 Oct 2018)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
TangoCash
2018-10-27 18:06:37 +02:00
committed by vanhofen
parent 6d7690ca91
commit 5ac4a438c0

View File

@@ -270,6 +270,10 @@ xmlDocPtr parseXmlFile(const char * filename, bool,const char* encoding)
{
enc = pugi::encoding_latin1;
}
else if ((line[0] == 0xef) && (line[1] == 0xbb) && (line[2] == 0xbf))
{
enc = pugi::encoding_utf8;
}
in.close();
}
}
@@ -307,6 +311,11 @@ xmlDocPtr parseXmlFile(const char * filename, bool,const char* encoding)
size_t read_size = gzread(xmlgz_file,buffer,gzsize);
char utf8[3];
strncpy(utf8,(char *)buffer,3);
if ((utf8[0] == 0xef) && (utf8[1] == 0xbb) && (utf8[2] == 0xbf))
enc = pugi::encoding_utf8;
if (read_size != gzsize)
{
gzclose(xmlgz_file);