Do not attempt to convert encoding if it is already utf-8.

This commit is contained in:
tastytea 2019-12-11 17:16:35 +01:00
parent d4d7cd4efd
commit 56dc4083ce
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 6 additions and 1 deletions

View File

@ -688,6 +688,11 @@ string URI::to_utf8(const string &str)
detect_encoding();
}
if (_encoding == "utf-8")
{
return str;
}
return boost::locale::conv::to_utf<char>(str, _encoding);
}
@ -698,7 +703,7 @@ void URI::detect_encoding()
re_encoding.split(_document, matches);
if (matches.size() >= 2)
{
_encoding = matches[1];
_encoding = boost::locale::to_lower(matches[1]);
}
}