2323
2424#include "url.h"
2525#include "file.h"
26- #ifdef _OSD_POSIX
27- # ifndef CHARSET_EBCDIC
28- # define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */
29- # endif
30- # include "ebcdic.h"
31- #endif /*_OSD_POSIX*/
3226
3327/* {{{ free_url
3428 */
@@ -469,7 +463,6 @@ PHPAPI zend_string *php_url_encode(char const *s, size_t len)
469463
470464 if (c == ' ' ) {
471465 * to ++ = '+' ;
472- #ifndef CHARSET_EBCDIC
473466 } else if ((c < '0' && c != '-' && c != '.' ) ||
474467 (c < 'A' && c > '9' ) ||
475468 (c > 'Z' && c < 'a' && c != '_' ) ||
@@ -478,14 +471,6 @@ PHPAPI zend_string *php_url_encode(char const *s, size_t len)
478471 to [1 ] = hexchars [c >> 4 ];
479472 to [2 ] = hexchars [c & 15 ];
480473 to += 3 ;
481- #else /*CHARSET_EBCDIC*/
482- } else if (!isalnum (c ) && strchr ("_-." , c ) == NULL ) {
483- /* Allow only alphanumeric chars and '_', '-', '.'; escape the rest */
484- to [0 ] = '%' ;
485- to [1 ] = hexchars [os_toascii [c ] >> 4 ];
486- to [2 ] = hexchars [os_toascii [c ] & 15 ];
487- to += 3 ;
488- #endif /*CHARSET_EBCDIC*/
489474 } else {
490475 * to ++ = c ;
491476 }
@@ -542,11 +527,7 @@ PHPAPI size_t php_url_decode(char *str, size_t len)
542527 }
543528 else if (* data == '%' && len >= 2 && isxdigit ((int ) * (data + 1 ))
544529 && isxdigit ((int ) * (data + 2 ))) {
545- #ifndef CHARSET_EBCDIC
546530 * dest = (char ) php_htoi (data + 1 );
547- #else
548- * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
549- #endif
550531 data += 2 ;
551532 len -= 2 ;
552533 } else {
@@ -574,20 +555,13 @@ PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len)
574555 char c = s [x ];
575556
576557 ret [y ] = c ;
577- #ifndef CHARSET_EBCDIC
578558 if ((c < '0' && c != '-' && c != '.' ) ||
579559 (c < 'A' && c > '9' ) ||
580560 (c > 'Z' && c < 'a' && c != '_' ) ||
581561 (c > 'z' && c != '~' )) {
582562 ret [y ++ ] = '%' ;
583563 ret [y ++ ] = hexchars [(unsigned char ) c >> 4 ];
584564 ret [y ] = hexchars [(unsigned char ) c & 15 ];
585- #else /*CHARSET_EBCDIC*/
586- if (!isalnum (c ) && strchr ("_-.~" , c ) != NULL ) {
587- ret [y ++ ] = '%' ;
588- ret [y ++ ] = hexchars [os_toascii [(unsigned char ) c ] >> 4 ];
589- ret [y ] = hexchars [os_toascii [(unsigned char ) c ] & 15 ];
590- #endif /*CHARSET_EBCDIC*/
591565 }
592566 }
593567 ret [y ] = '\0' ;
@@ -638,11 +612,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
638612 while (len -- ) {
639613 if (* data == '%' && len >= 2 && isxdigit ((int ) * (data + 1 ))
640614 && isxdigit ((int ) * (data + 2 ))) {
641- #ifndef CHARSET_EBCDIC
642615 * dest = (char ) php_htoi (data + 1 );
643- #else
644- * dest = os_toebcdic [(unsigned char ) php_htoi (data + 1 )];
645- #endif
646616 data += 2 ;
647617 len -= 2 ;
648618 } else {
0 commit comments