mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 21:49:55 +00:00
components/translation: use Utf8Encoder
This commit is contained in:
parent
67273fc177
commit
9906c3051d
2 changed files with 3 additions and 4 deletions
|
@ -50,10 +50,7 @@ namespace Translation
|
||||||
|
|
||||||
if (!line.empty())
|
if (!line.empty())
|
||||||
{
|
{
|
||||||
char* buffer = ToUTF8::getBuffer(line.size() + 1);
|
line = mEncoder.getUtf8(line);
|
||||||
//buffer has at least line.size() + 1 bytes, so it must be safe
|
|
||||||
strcpy(buffer, line.c_str());
|
|
||||||
line = ToUTF8::getUtf8(mEncoding);
|
|
||||||
|
|
||||||
size_t tab_pos = line.find('\t');
|
size_t tab_pos = line.find('\t');
|
||||||
if (tab_pos != std::string::npos && tab_pos > 0 && tab_pos < line.size() - 1)
|
if (tab_pos != std::string::npos && tab_pos > 0 && tab_pos < line.size() - 1)
|
||||||
|
@ -107,6 +104,7 @@ namespace Translation
|
||||||
void Storage::setEncoding (const ToUTF8::FromType& encoding)
|
void Storage::setEncoding (const ToUTF8::FromType& encoding)
|
||||||
{
|
{
|
||||||
mEncoding = encoding;
|
mEncoding = encoding;
|
||||||
|
mEncoder.setEncoding(encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Storage::hasTranslation() const
|
bool Storage::hasTranslation() const
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace Translation
|
||||||
|
|
||||||
|
|
||||||
ToUTF8::FromType mEncoding;
|
ToUTF8::FromType mEncoding;
|
||||||
|
ToUTF8::Utf8Encoder mEncoder;
|
||||||
ContainerType mCellNamesTranslations, mTopicIDs, mPhraseForms;
|
ContainerType mCellNamesTranslations, mTopicIDs, mPhraseForms;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue