mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-12 14:26:49 +01:00
Simplified preferredencoding()
Not sure what is the point to use yield to return encoding, thus it will simplify the whole function. Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
This commit is contained in:
parent
d4e16d3e97
commit
bae611f216
@ -32,15 +32,13 @@ def preferredencoding():
|
|||||||
Returns the best encoding scheme for the system, based on
|
Returns the best encoding scheme for the system, based on
|
||||||
locale.getpreferredencoding() and some further tweaks.
|
locale.getpreferredencoding() and some further tweaks.
|
||||||
"""
|
"""
|
||||||
def yield_preferredencoding():
|
try:
|
||||||
try:
|
pref = locale.getpreferredencoding()
|
||||||
pref = locale.getpreferredencoding()
|
u'TEST'.encode(pref)
|
||||||
u'TEST'.encode(pref)
|
except:
|
||||||
except:
|
pref = 'UTF-8'
|
||||||
pref = 'UTF-8'
|
|
||||||
while True:
|
return pref
|
||||||
yield pref
|
|
||||||
return yield_preferredencoding().next()
|
|
||||||
|
|
||||||
|
|
||||||
def htmlentity_transform(matchobj):
|
def htmlentity_transform(matchobj):
|
||||||
|
Loading…
Reference in New Issue
Block a user