Fix URL character encoding bug in mimedb

darcs-hash:20070417062932-ac50b-7816e307ab180be02fc247f6c4796e7fa774862d.gz
This commit is contained in:
axel 2007-04-17 16:29:32 +10:00
parent 52f9560b4f
commit 90c5cea43d

View file

@ -742,6 +742,7 @@ static void writer_hex( int num )
int a, b; int a, b;
a = num /16; a = num /16;
b = num %16; b = num %16;
writer( a>9?('A'+a-10):('0'+a)); writer( a>9?('A'+a-10):('0'+a));
writer( b>9?('A'+b-10):('0'+b)); writer( b>9?('A'+b-10):('0'+b));
} }
@ -830,7 +831,7 @@ static void write_url( char *file )
if( ((*str >= 'a') && (*str <='z')) || if( ((*str >= 'a') && (*str <='z')) ||
((*str >= 'A') && (*str <='Z')) || ((*str >= 'A') && (*str <='Z')) ||
((*str >= '0') && (*str <='9')) || ((*str >= '0') && (*str <='9')) ||
(strchr( "./_",*str) != 0) ) (strchr( "-_.~/",*str) != 0) )
{ {
writer(*str); writer(*str);
} }
@ -842,7 +843,7 @@ static void write_url( char *file )
else else
{ {
writer( '%' ); writer( '%' );
writer_hex( *str ); writer_hex( (unsigned char)*str );
} }
str++; str++;
} }