@@ -446,16 +446,8 @@ def decode_params(params):
446446 new_params .append ((name , '"%s"' % value ))
447447 return new_params
448448
449- _SANITIZE_TABLE = str .maketrans ({i : None for i in range (128 , 65536 )})
450-
451- def _sanitize_charset_name (charset , fallback_charset ):
452- if not charset :
453- return charset
454- sanitized = charset .translate (_SANITIZE_TABLE )
455- return sanitized if sanitized else fallback_charset
456-
457449def collapse_rfc2231_value (value , errors = 'replace' ,
458- fallback_charset = 'ascii' ):
450+ fallback_charset = 'us- ascii' ):
459451 if not isinstance (value , tuple ) or len (value ) != 3 :
460452 return unquote (value )
461453 # While value comes to us as a unicode string, we need it to be a bytes
@@ -466,7 +458,6 @@ def collapse_rfc2231_value(value, errors='replace',
466458 # Issue 17369: if charset/lang is None, decode_rfc2231 couldn't parse
467459 # the value, so use the fallback_charset.
468460 charset = fallback_charset
469- charset = _sanitize_charset_name (charset , fallback_charset )
470461 rawbytes = bytes (text , 'raw-unicode-escape' )
471462 try :
472463 return str (rawbytes , charset , errors )
0 commit comments