mirror of
https://codeberg.org/polarisfm/youtube-dl.git
synced 2024-12-29 11:05:13 +00:00
[utils] Add encode_compat_str
This commit is contained in:
parent
8900ab4d9b
commit
8e60dc7526
1 changed files with 4 additions and 0 deletions
|
@ -1712,6 +1712,10 @@ def encode_dict(d, encoding='utf-8'):
|
|||
return dict((encode(k), encode(v)) for k, v in d.items())
|
||||
|
||||
|
||||
def encode_compat_str(string, encoding=preferredencoding(), errors='strict'):
|
||||
return string if isinstance(string, compat_str) else compat_str(string, encoding, errors)
|
||||
|
||||
|
||||
US_RATINGS = {
|
||||
'G': 0,
|
||||
'PG': 10,
|
||||
|
|
Loading…
Reference in a new issue