# The only allowed value for the “accept-charset” attribute for the “form” element is “utf-8”.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-only-allowed-value-for-the-accept-charset-attribute-for-the-form-element-is-utf-8
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `accept-charset` attribute on a `<form>` element only accepts `"UTF-8"` as its value. Any other character encoding will trigger a validation error.

Older HTML specifications allowed values like `"ISO-8859-1"`, `"Windows-1252"`, or space-separated lists of encodings. The HTML living standard changed this. Now, `"UTF-8"` is the sole permitted value. Browsers already default to submitting form data in UTF-8 when no `accept-charset` is specified, so the attribute is rarely needed at all.

If a form currently specifies a non-UTF-8 encoding, the fix is either to switch the value to `"UTF-8"` or to remove the attribute entirely. Removing it is usually the better choice, since the browser will use UTF-8 by default when the page itself is served as UTF-8 (which it should be).

## HTML examples

### Invalid usage

```html
<form action="/search" accept-charset="ISO-8859-1">
  <input type="text" name="q">
  <button type="submit">Search</button>
</form>
```

### Valid usage

Remove the attribute and let the browser default to UTF-8:

```html
<form action="/search">
  <input type="text" name="q">
  <button type="submit">Search</button>
</form>
```

Or explicitly set it to `"UTF-8"`:

```html
<form action="/search" accept-charset="UTF-8">
  <input type="text" name="q">
  <button type="submit">Search</button>
</form>
```
