Date: 11/20/00
- Next message: kir <email protected>: "[PHP-DEV] PHP 4.0 Bug #7138 Updated: quoted_printable_decode doesn't handle soft line breaks"
- Previous message: Alan <email protected>: "[PHP-DEV] PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 5321
Updated by: kir
Reported By: mcp <email protected>
Status: Closed
Bug Type: Strings related
Assigned To: kir
Comments:
Check the latest version on http://snaps.php.net
or wait until 4.0.4.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-17 06:36:57] kir <email protected>
Should be fixed in the latest CVS.
---------------------------------------------------------------------------
[2000-10-02 22:26:09] sniper <email protected>
Could someone check this out who knows the internals of
ext/standard/quot_print.c ??
--Jani
---------------------------------------------------------------------------
[2000-09-04 21:03:50] sniper <email protected>
Is this still happening with php4.0.2 (or preferrably latest CVS) ??
--Jani
---------------------------------------------------------------------------
[2000-07-27 20:18:11] waldschrott <email protected>
checking out
---------------------------------------------------------------------------
[2000-07-02 00:20:47] mcp <email protected>
The following code will produce the correct results (with a probable speed increase).
/*
*
* Decoding Quoted-printable string.
*
*** modified 2000.06.30 by Mark Peters
*** fixed code to recognize '= cr lf' sequence as soft newline
*** and ignore (hide) mis-formed or bogus escape sequences
*/
/* {{{ proto string quoted_printable_decode(string str)
Convert a quoted-printable string to an 8 bit string */
PHP_FUNCTION(quoted_printable_decode)
{
pval **arg1;
char *str;
int i = 0, j = 0;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1,&arg1)==FAILURE)
{
WRONG_PARAM_COUNT;
}
convert_to_string_ex(arg1);
str = (*arg1)->value.str.val;
while ( str[i] )
{
if (str[i] == '=') // start of escape sequence
{
// look for soft line break sequence ( = cr lf )
if (str[i+1] == 13 && str[i+2] == 10)
{
i += 3; // skip over crlf sequence
continue;
}
// first digit not hex?
if (!isxdigit((int)str[i+1]))
{
++i;
continue;
}
// second digit not hex?
if (!isxdigit((int)str[i+2]))
{
i += 2;
continue;
}
// good escape code
str[j++] = (php_hex2int((int)str[i+1]) << 4 ) + php_hex2int((int)str[i+2]);
i += 3;
continue;
}
str[j++] = str[i++];
}
str[j] = '
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: kir <email protected>: "[PHP-DEV] PHP 4.0 Bug #7138 Updated: quoted_printable_decode doesn't handle soft line breaks"
- Previous message: Alan <email protected>: "[PHP-DEV] PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

