> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set UTF-8 encoding

> Set encoding for the request to UTF-8 based on the 'from encoding' with a user selected error option.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Set encoding for the request to UTF-8 based on the 'from encoding' with a user selected error option. Add this to a connection when the other system sends back text in a character encoding other than UTF-8, which can leave accented letters or special symbols looking garbled. This plugin converts the response from the encoding you name into UTF-8 so the rest of your integration reads clean, consistent text. You also choose what should happen to any characters that cannot be converted: stop with an error, replace them with a close approximation, or simply drop them.

This documentation describes: [Schema](/schemas/http-client-plugin-configurator/set-encoding-utf-8)

## Fields

<FormField property="fromEncoding" label="Original encoding">
  The encoding the incoming text is currently in, for example `ISO-8859-1` or `Windows-1252`. This is the encoding the plugin converts from. Leave it empty to assume the text is already UTF-8.
</FormField>

<FormField property="onError" label="Invalid characters" required>
  How to handle characters that cannot be converted to UTF-8. Choose one of:

  * **Trigger an error** stops and fails the request when an invalid character is found.
  * **Approximate characters** replaces each one with the closest UTF-8 equivalent.
  * **Ignore invalid characters** drops them from the text.

  Defaults to *Ignore invalid characters*.
</FormField>

## Sample data

This plugin converts the response body from the encoding you name into UTF-8. The text itself is unchanged; only its encoding is corrected, so characters that were previously garbled display correctly.

For example, when the other system returns text encoded as Windows-1252 and you want any characters that do not map cleanly to be approximated rather than dropped:

| Field              | Value                  |
| ------------------ | ---------------------- |
| Original encoding  | `Windows-1252`         |
| Invalid characters | Approximate characters |

```json Configuration theme={null}
{
  "prototype": "set-encoding-utf-8",
  "parameters": {
    "fromEncoding": "Windows-1252",
    "onError": "TRANSLIT"
  }
}
```
