diff options
author | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-12-02 07:36:42 +0000 |
---|---|---|
committer | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-12-02 07:36:42 +0000 |
commit | 3c02eb1ffe031d74f1792477979b787a46486636 (patch) | |
tree | e8e535e6573d8fa9d1235e4cf550839d677c1232 /ext/standard/quot_print.c | |
parent | e9f7e144608df36473490a5bd4b40c54bad83f0f (diff) | |
download | php-git-3c02eb1ffe031d74f1792477979b787a46486636.tar.gz |
all '_' (underscores) should be replaced by '\x20' (whitespaces)
in encoding.
# should I bump API version?
Diffstat (limited to 'ext/standard/quot_print.c')
-rw-r--r-- | ext/standard/quot_print.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c index 7c711655a7..3498006c57 100644 --- a/ext/standard/quot_print.c +++ b/ext/standard/quot_print.c @@ -50,7 +50,7 @@ static char php_hex2int(int c) } } -PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t length, size_t *ret_length) +PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t length, size_t *ret_length, int replace_us_by_ws) { register unsigned int i; register unsigned const char *p1; @@ -79,6 +79,10 @@ PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t len 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 }; + if (replace_us_by_ws) { + replace_us_by_ws = '_'; + } + i = length, p1 = str; buf_size = length; while (i > 1 && *p1 != '\0') { @@ -127,7 +131,7 @@ PHPAPI unsigned char *php_quot_print_decode(const unsigned char *str, size_t len return NULL; } } else { - *(p2++) = *p1; + *(p2++) = (replace_us_by_ws == *p1 ? '\x20': *p1); i--, p1++, decoded_len++; } } |