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
This commit is contained in:
Michael Wetherell 2005-04-03 21:20:11 +00:00
parent 98cfeab393
commit 561488efd4

View File

@ -647,6 +647,15 @@ size_t wxMBConvUTF8::MB2WC(wchar_t *buf, const char *psz, size_t n) const
if (buf) if (buf)
*buf++ = cc; *buf++ = cc;
len++; 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 else
{ {
@ -784,6 +793,14 @@ size_t wxMBConvUTF8::WC2MB(char *buf, const wchar_t *psz, size_t n) const
*buf++ = (char)(cc - wxUnicodePUA); *buf++ = (char)(cc - wxUnicodePUA);
len++; 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) && else if ( (m_options & MAP_INVALID_UTF8_TO_OCTAL) &&
cc == L'\\' && cc == L'\\' &&
isoctal(psz[0]) && isoctal(psz[1]) && isoctal(psz[2]) ) isoctal(psz[0]) && isoctal(psz[1]) && isoctal(psz[2]) )