MCPcopy Index your code
hub / github.com/borgbackup/borg / safe_encode

Function safe_encode

src/borg/helpers/parseformat.py:68–72  ·  view source on GitHub ↗

Encode str to bytes, with round-tripping of "invalid" bytes.

(s, coding="utf-8", errors="surrogateescape")

Source from the content-addressed store, hash-verified

66
67
68def safe_encode(s, coding="utf-8", errors="surrogateescape"):
69 """Encode str to bytes, with round-tripping of "invalid" bytes."""
70 if s is None:
71 return None
72 return s.encode(coding, errors)
73
74
75def remove_surrogates(s, errors="replace"):

Callers 2

_build_files_cacheMethod · 0.85
process_fileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected