Make escaped strings more readable

darcs-hash:20070925161916-75c98-c33aa140fb099f2003e5af3dadb5f613075b59d6.gz
This commit is contained in:
liljencrantz 2007-09-26 02:19:16 +10:00
parent cf8e746d0c
commit 5694d3f027

View File

@ -795,6 +795,13 @@ wchar_t *escape( const wchar_t *in_orig,
need_escape=need_complex_escape=1; need_escape=need_complex_escape=1;
break; break;
case L'\x1b':
*(pos++) = L'\\';
*(pos++) = L'e';
need_escape=need_complex_escape=1;
break;
case L'\\': case L'\\':
case L'\'': case L'\'':
{ {
@ -837,6 +844,18 @@ wchar_t *escape( const wchar_t *in_orig,
{ {
if( *in < 32 ) if( *in < 32 )
{ {
if( *in <27 && *in > 0 )
{
*(pos++) = L'\\';
*(pos++) = L'c';
*(pos++) = L'a' + *in -1;
need_escape=need_complex_escape=1;
break;
}
int tmp = (*in)%16; int tmp = (*in)%16;
*pos++ = L'\\'; *pos++ = L'\\';
*pos++ = L'x'; *pos++ = L'x';