charset_transcode
Convert text between character encodings like cp1252 and utf-8, with configurable error handlers for invalid bytes.
Instructions
Convert text between character encodings (e.g. latin-1/cp1252 <-> utf-8).
The input is encoded under from_charset to recover its raw bytes, which are
then decoded under to_charset. If the bytes aren't valid to_charset text
they're returned as bare hex with output_format='hex' (otherwise 'text').
errors selects the codec error handler (strict|replace|ignore|…).
Returns {from_charset, to_charset, result, output_format}.
Example: charset_transcode("café", "cp1252", "utf-8") -> result "café"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to reinterpret across encodings. | |
| from_charset | Yes | Encoding to encode `text` under to recover its raw bytes, e.g. cp1252, latin-1, utf-8. | |
| to_charset | Yes | Encoding to decode those bytes under, e.g. utf-8. | |
| errors | No | Codec error handler applied to both legs: strict|replace|ignore|backslashreplace|…. Default 'strict'. | strict |