From 56dc4083cee5ff84af0347949143f364f500d67c Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 11 Dec 2019 17:16:35 +0100 Subject: [PATCH] Do not attempt to convert encoding if it is already utf-8. --- src/lib/uri.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/uri.cpp b/src/lib/uri.cpp index 7780732..9cd24ef 100644 --- a/src/lib/uri.cpp +++ b/src/lib/uri.cpp @@ -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(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]); } }