Replace %xx escapes by their single-character equivalent. The optional encoding and errors parameters specify how to decode percent- encoded sequences. Wrapper to Python's `unquote` while remaining compatible with both Python 2 & 3 since the reference to this functio
(content, encoding="utf-8", errors="replace")
| 578 | |
| 579 | @staticmethod |
| 580 | def unquote(content, encoding="utf-8", errors="replace"): |
| 581 | """Replace %xx escapes by their single-character equivalent. The |
| 582 | optional encoding and errors parameters specify how to decode percent- |
| 583 | encoded sequences. |
| 584 | |
| 585 | Wrapper to Python's `unquote` while remaining compatible with both |
| 586 | Python 2 & 3 since the reference to this function changed between |
| 587 | versions. |
| 588 | |
| 589 | Note: errors set to 'replace' means that invalid sequences are |
| 590 | replaced by a placeholder character. |
| 591 | |
| 592 | Args: |
| 593 | content (str): The quoted URI string you wish to unquote |
| 594 | encoding (:obj:`str`, optional): encoding type |
| 595 | errors (:obj:`str`, errors): how to handle invalid character found |
| 596 | in encoded string (defined by encoding) |
| 597 | |
| 598 | Returns: |
| 599 | str: The unquoted URI string |
| 600 | """ |
| 601 | if not content: |
| 602 | return "" |
| 603 | |
| 604 | return _unquote(content, encoding=encoding, errors=errors) |
| 605 | |
| 606 | @staticmethod |
| 607 | def quote(content, safe="/", encoding=None, errors=None): |
no outgoing calls