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')
| 861 | return r |
| 862 | |
| 863 | def unquote_plus(string, encoding='utf-8', errors='replace'): |
| 864 | """Like unquote(), but also replace plus signs by spaces, as required for |
| 865 | unquoting HTML form values. |
| 866 | |
| 867 | unquote_plus('%7e/abc+def') -> '~/abc def' |
| 868 | """ |
| 869 | string = string.replace('+', ' ') |
| 870 | return unquote(string, encoding, errors) |
| 871 | |
| 872 | _ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| 873 | b'abcdefghijklmnopqrstuvwxyz' |