Make the jobname (but... not only jobname) preserves 8bit filename in almost URL encoding (RFC ???) format. diff -ru LPRng-3.8.28.orig/src/common/getqueue.c src/common/getqueue.c --- LPRng-3.8.28.orig/src/common/getqueue.c Fri Apr 8 15:18:14 2005 +++ src/common/getqueue.c Fri Apr 8 16:33:27 2005 @@ -447,7 +447,7 @@ memset(datafile,0,sizeof(datafile[0])); for( i = 0; i < cf_line_list.count; ++i ){ s = cf_line_list.list[i]; - Clean_meta(s); + s = Raw_url_encode(s); c = cval(s); DEBUG3("Set_job_ticket_from_cf_info: doing line '%s'", s ); if( islower(c) ){ diff -ru LPRng-3.8.28.orig/src/common/linelist.c src/common/linelist.c --- LPRng-3.8.28.orig/src/common/linelist.c Fri Apr 8 15:18:14 2005 +++ src/common/linelist.c Fri Apr 8 16:49:20 2005 @@ -2955,6 +2955,30 @@ } } +/* FROM PHP 4.3.11, modify to include LESS_SAFE */ +char *Raw_url_encode(char *s) +{ + static unsigned char hexchars[] = "0123456789ABCDEF"; + register int x, y; + unsigned char *str; + int len = safestrlen(s); + + str = (unsigned char *) malloc_or_die(sizeof(char) * 3 * len + 1, __FILE__, __LINE__); + for (x = 0, y = 0; len--; x++, y++) { + str[y] = (unsigned char) s[x]; + if ((str[y] < '+' && str[y] != '(' && str[y] != ')' && str[y] != '%') || + (str[y] < 'A' && str[y] > '9' && str[y] != '@' && str[y] != ':' && str[y] != '=') || + (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') || + (str[y] > 'z')) { + str[y++] = '%'; + str[y++] = hexchars[(unsigned char) s[x] >> 4]; + str[y] = hexchars[(unsigned char) s[x] & 15]; + } + } + str[y] = '\0'; + return ((char *) str); +} + /********************************************************************** * Dump_parms( char *title, struct keywords *k ) * - dump the list of keywords and variable values given by the diff -ru LPRng-3.8.28.orig/src/include/linelist.h src/include/linelist.h --- LPRng-3.8.28.orig/src/include/linelist.h Fri Apr 8 15:18:14 2005 +++ src/include/linelist.h Fri Apr 8 15:55:41 2005 @@ -276,6 +276,7 @@ int Is_meta( int c ); char *Find_meta( char *s ); void Clean_meta( char *t ); +char *Raw_url_encode( char *s ); void Dump_parms( char *title, struct keywords *k ); void Dump_default_parms( int fd, char *title, struct keywords *k ); void Remove_sequential_separators( char *start );