From 561488efd4ab9cc0d78c3639fd13759d7dbcbb83 Mon Sep 17 00:00:00 2001 From: Michael Wetherell Date: Sun, 3 Apr 2005 21:20:11 +0000 Subject: [PATCH] The octal escaping code needs to escape the escape character git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33312 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/strconv.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 20ff6f49ef..9df03b339f 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -647,6 +647,15 @@ size_t wxMBConvUTF8::MB2WC(wchar_t *buf, const char *psz, size_t n) const if (buf) *buf++ = cc; len++; + + // escape the escape character for octal escapes + if ((m_options & MAP_INVALID_UTF8_TO_OCTAL) + && cc == '\\' && (!buf || len < n)) + { + if (buf) + *buf++ = cc; + len++; + } } else { @@ -784,6 +793,14 @@ size_t wxMBConvUTF8::WC2MB(char *buf, const wchar_t *psz, size_t n) const *buf++ = (char)(cc - wxUnicodePUA); len++; } + else if ( (m_options & MAP_INVALID_UTF8_TO_OCTAL) + && cc == L'\\' && psz[0] == L'\\' ) + { + if (buf) + *buf++ = (char)cc; + psz++; + len++; + } else if ( (m_options & MAP_INVALID_UTF8_TO_OCTAL) && cc == L'\\' && isoctal(psz[0]) && isoctal(psz[1]) && isoctal(psz[2]) )