Fix charset detection and conversion issues

This commit is contained in:
Pierre Jeanjean 2020-02-02 15:37:05 +01:00
parent 0348d60019
commit 7bbf150b44
2 changed files with 4 additions and 2 deletions

View File

@ -22,7 +22,6 @@ namespace agi {
line_iterator_base::line_iterator_base(std::istream &stream, std::string encoding)
: stream(&stream)
{
boost::to_lower(encoding);
if (encoding != "utf-8") {
agi::charset::IconvWrapper c("utf-8", encoding.c_str());
c.Convert("\r", 1, reinterpret_cast<char *>(&cr), sizeof(int));

View File

@ -47,8 +47,11 @@ namespace CharSetDetect {
std::string GetEncoding(agi::fs::path const& filename) {
auto encoding = agi::charset::Detect(filename);
if (!encoding.empty())
if (!encoding.empty()) {
if (!encoding.compare("ASCII"))
encoding = "utf-8";
return encoding;
}
auto choices = agi::charset::GetEncodingsList<wxArrayString>();
int choice = wxGetSingleChoiceIndex(