mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Merge pull request #1639 from IvanSavenko/fix_localized_text_files
Fix loading of non-ASCII text files
This commit is contained in:
commit
674c9a9eac
@ -99,13 +99,14 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
CLegacyConfigParser::CLegacyConfigParser(std::string URI):
|
||||
CLegacyConfigParser(CResourceHandler::get()->load(ResourceID(URI, EResType::TEXT)))
|
||||
CLegacyConfigParser::CLegacyConfigParser(std::string URI)
|
||||
{
|
||||
}
|
||||
ResourceID resource(URI, EResType::TEXT);
|
||||
auto input = CResourceHandler::get()->load(resource);
|
||||
std::string modName = VLC->modh->findResourceOrigin(resource);
|
||||
std::string language = VLC->modh->getModLanguage(modName);
|
||||
fileEncoding = Languages::getLanguageOptions(language).encoding;
|
||||
|
||||
CLegacyConfigParser::CLegacyConfigParser(const std::unique_ptr<CInputStream> & input)
|
||||
{
|
||||
data.reset(new char[input->getSize()]);
|
||||
input->read(reinterpret_cast<uint8_t*>(data.get()), input->getSize());
|
||||
|
||||
|
@ -34,6 +34,7 @@ class DLL_LINKAGE CLegacyConfigParser
|
||||
|
||||
/// reads "raw" string without encoding conversion
|
||||
std::string readRawString();
|
||||
|
||||
public:
|
||||
/// read one entry from current line. Return ""/0 if end of line reached
|
||||
std::string readString();
|
||||
@ -56,8 +57,6 @@ public:
|
||||
bool endLine();
|
||||
|
||||
explicit CLegacyConfigParser(std::string URI);
|
||||
private:
|
||||
explicit CLegacyConfigParser(const std::unique_ptr<CInputStream> & input);
|
||||
};
|
||||
|
||||
class CGeneralTextHandler;
|
||||
|
Loading…
Reference in New Issue
Block a user