charset_transcode
Convert text between character encodings such as cp1252 and utf-8 by reinterpreting raw bytes, with configurable error handling and hex output for invalid sequences.
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é"
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"text": "<text>",
"from_charset": "<from_charset>",
"to_charset": "<to_charset>"
},
"name": "charset_transcode"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to reinterpret across encodings. | |
| errors | No | Codec error handler applied to both legs: strict|replace|ignore|backslashreplace|…. Default 'strict'. | strict |
| to_charset | Yes | Encoding to decode those bytes under, e.g. utf-8. | |
| from_charset | Yes | Encoding to encode `text` under to recover its raw bytes, e.g. cp1252, latin-1, utf-8. |