Attention

You are looking at outdated documentation for version 2.x. A newer version is available.

wsgidav.util.safeReEncode

wsgidav.util.safeReEncode(s, encoding_to, errors='backslashreplace')[source]

Re-encode str or binary so that is compatible with a given encoding (replacing unsupported chars).

We use ASCII as default, which gives us some output that contains ™ and u9999 for every character > 127, for easier debugging. (e.g. if we don’t know the encoding, see #87, #96)