aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorArvydas Sidorenko <asido4@gmail.com>2012-07-01 18:21:27 +0200
committerArvydas Sidorenko <asido4@gmail.com>2012-07-01 18:21:27 +0200
commitbae611f216ac7b1f1a24a506da6dffc518d09d5b (patch)
tree7e6892f70d10a0ba17528fbc85c595c53438b51d /youtube_dl/utils.py
parentd4e16d3e9736fd4419b8bd2b088b5dec086ae07d (diff)
downloadyoutube-dl-bae611f216ac7b1f1a24a506da6dffc518d09d5b.tar.xz
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>
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 2853ba50f..7faa046c8 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -32,15 +32,13 @@ def preferredencoding():
Returns the best encoding scheme for the system, based on
locale.getpreferredencoding() and some further tweaks.
"""
- def yield_preferredencoding():
- try:
- pref = locale.getpreferredencoding()
- u'TEST'.encode(pref)
- except:
- pref = 'UTF-8'
- while True:
- yield pref
- return yield_preferredencoding().next()
+ try:
+ pref = locale.getpreferredencoding()
+ u'TEST'.encode(pref)
+ except:
+ pref = 'UTF-8'
+
+ return pref
def htmlentity_transform(matchobj):