Like unquote(), but also replace plus signs by spaces, as required for unquoting HTML form values. unquote_plus('%7e/abc+def') -> '~/abc def'
(string, encoding='utf-8', errors='replace')
| 981 | return r |
| 982 | |
| 983 | def unquote_plus(string, encoding='utf-8', errors='replace'): |
| 984 | """Like unquote(), but also replace plus signs by spaces, as required for |
| 985 | unquoting HTML form values. |
| 986 | |
| 987 | unquote_plus('%7e/abc+def') -> '~/abc def' |
| 988 | """ |
| 989 | string = string.replace('+', ' ') |
| 990 | return unquote(string, encoding, errors) |
| 991 | |
| 992 | _ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| 993 | b'abcdefghijklmnopqrstuvwxyz' |