forked from mirror/openmw-tes3mp
modified esm reader/writer to use UTF8 when no encoder is given
This commit is contained in:
parent
903e867c24
commit
35bf98a940
2 changed files with 7 additions and 4 deletions
|
@ -303,7 +303,10 @@ std::string ESMReader::getString(int size)
|
|||
getExact(ptr, size);
|
||||
|
||||
// Convert to UTF8 and return
|
||||
if (mEncoder)
|
||||
return mEncoder->getUtf8(ptr, size);
|
||||
|
||||
return std::string (ptr, size);
|
||||
}
|
||||
|
||||
void ESMReader::fail(const std::string &msg)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace ESM
|
||||
{
|
||||
ESMWriter::ESMWriter() : mRecordCount (0), mCounting (true) {}
|
||||
ESMWriter::ESMWriter() : mEncoder (0), mRecordCount (0), mCounting (true) {}
|
||||
|
||||
unsigned int ESMWriter::getVersion() const
|
||||
{
|
||||
|
@ -152,9 +152,9 @@ namespace ESM
|
|||
else
|
||||
{
|
||||
// Convert to UTF8 and return
|
||||
std::string ascii = mEncoder->getLegacyEnc(data);
|
||||
std::string string = mEncoder ? mEncoder->getLegacyEnc(data) : data;
|
||||
|
||||
write(ascii.c_str(), ascii.size());
|
||||
write(string.c_str(), string.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue