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')
| 800 | return r |
| 801 | |
| 802 | def unquote_plus(string, encoding='utf-8', errors='replace'): |
| 803 | """Like unquote(), but also replace plus signs by spaces, as required for |
| 804 | unquoting HTML form values. |
| 805 | |
| 806 | unquote_plus('%7e/abc+def') -> '~/abc def' |
| 807 | """ |
| 808 | string = string.replace('+', ' ') |
| 809 | return unquote(string, encoding, errors) |
| 810 | |
| 811 | _ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| 812 | b'abcdefghijklmnopqrstuvwxyz' |