Fix wxURI::Unescape() to work with Unicode strings

Such strings are not really URIs as they should have been encoded if they were
but we can obtain them from e.g. wxFileSystem::FindFirst(), so handle them
correctly here as it's simpler than checking all the places where Unescape()
is called.

Add a unit test checking that decoding an URI containing both Unicode and
percent-encoded Unicode characters works correctly.
This commit is contained in:
Vadim Zeitlin
2016-02-13 03:59:43 +01:00
parent 0a555f3c83
commit 314630945a
4 changed files with 29 additions and 40 deletions

View File

@@ -338,6 +338,15 @@ void URITestCase::Unescaping()
"\xD1\x87\xD0\xB8\xD1\x81\xD0\xBB\xD0\xBE"
),
unescaped );
escaped = L"file://\u043C\u043E\u0439%5C%d1%84%d0%b0%d0%b9%d0%bb";
unescaped = wxURI::Unescape(escaped);
CPPUNIT_ASSERT_EQUAL
(
L"file://\u043C\u043E\u0439\\\u0444\u0430\u0439\u043B",
unescaped
);
#endif // wxUSE_UNICODE
}