[#3083] Fix missing common.utf8_encoded for backward compatibility

This commit is contained in:
Calum Lind 2017-06-29 14:19:50 +01:00
parent 33e9545cd4
commit 9164dafe69
1 changed files with 6 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import time
import chardet import chardet
import pkg_resources import pkg_resources
from deluge.decorators import deprecated
from deluge.error import InvalidPathError from deluge.error import InvalidPathError
try: try:
@ -921,6 +922,11 @@ def decode_bytes(byte_str, encoding='utf8'):
return '' return ''
@deprecated
def utf8_encoded(s, encoding='utf8'):
decode_bytes(s, encoding).encode('utf8')
def utf8_encode_structure(data): def utf8_encode_structure(data):
"""Recursively convert all unicode keys and values in a data structure to utf8. """Recursively convert all unicode keys and values in a data structure to utf8.