MCPcopy Index your code
hub / github.com/pyload/pyload / encode

Function encode

module/plugins/internal/misc.py:432–449  ·  view source on GitHub ↗

Unicode string -> encoded string (default to UTF-8)

(value, encoding='utf-8', errors='backslashreplace')

Source from the content-addressed store, hash-verified

430
431
432def encode(value, encoding='utf-8', errors='backslashreplace'):
433 """
434 Unicode string -> encoded string (default to UTF-8)
435 """
436 if isinstance(value, unicode):
437 res = value.encode(encoding, errors)
438
439 elif isinstance(value, str):
440 decoding = get_console_encoding(sys.stdin.encoding)
441 if encoding == decoding:
442 res = value
443 else:
444 res = transcode(value, decoding, encoding)
445
446 else:
447 res = str(value)
448
449 return res
450
451
452def rfc2047_dec(value):

Callers 12

xdcc_request_resumeMethod · 0.90
skipMethod · 0.85
dump_htmlMethod · 0.85
isarchiveMethod · 0.85
_make_tmpfileMethod · 0.85
parse_fileInfoFunction · 0.85
skipMethod · 0.85
abortMethod · 0.85
restartMethod · 0.85
retryMethod · 0.85
_update_pluginsMethod · 0.85
max_mtimeMethod · 0.85

Calls 3

transcodeFunction · 0.85
get_console_encodingFunction · 0.70
encodeMethod · 0.45

Tested by

no test coverage detected