encoding_decoding_string_escape
Escape or unescape strings for safe use in SQL, CSV, shell, regex, PHP, LDAP, XML, and C/C++ code. Transforms text to prevent syntax errors and injection risks.
Instructions
Escape or Unescape String Literals. Escape or unescape a string for a specific syntax so it is safe to paste into code or data: SQL, CSV, shell/Bash, regular-expression, PHP, LDAP filter, XML attribute, or C/C++ string. Use this for language/format string-literal quoting; use encoding_decoding_url for percent-encoding and encoding_decoding_html_entities for HTML entity conversion. Runs locally on the supplied text: read-only, non-destructive, offline, and rate-limited. Returns the transformed string plus format metadata, an escaping analysis, and the list of supported formats.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The string to escape or unescape. Required, non-empty. | |
| format | Yes | Target syntax. sql doubles single quotes; csv RFC-4180 quoting; shell backslash-escapes metachars; regex escapes metachars; php escapes backslash and quote; ldap RFC-4515 hex escapes; xml_attr entity-escapes; c_string C/C++ literal escapes. | |
| operation | No | Whether to escape (default) or reverse-unescape the text for the chosen format. | escape |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Whether the operation succeeded. | |
| input | No | The original text, echoed back. | |
| operation | No | The operation performed (escape or unescape). | |
| format | No | The format used. | |
| result | No | The escaped or unescaped output string. | |
| format_info | No | Metadata for the chosen format. | |
| analysis | No | Heuristic analysis of the input text. | |
| available_formats | No | Map of format id to display label for all supported formats. |