﻿---
title: charset
description: Byte-order mark handling. preserve keeps whatever the file arrived with. Defaults to `preserve`
url: https://docs-v3-preview.elastic.dev/reference/core/charset
---

# charset
Byte-order mark handling. preserve keeps whatever the file arrived with.

## Values


| Value       | Notes |
|-------------|-------|
| `utf-8`     |       |
| `utf-8-bom` |       |
| `preserve`  |       |

**Default:** `preserve`

### `charset = utf-8`

```ini
charset = utf-8
```

<tab-set>
  <tab-item title="Before">
    ```csharp
    namespace N;

    public class Widget
    {
        public int Value { get; set; }

        public int Double()
        {
            return Value * 2;
        }
    }
    ```
  </tab-item>

  <tab-item title="After">
    ```csharp
    namespace N;

    public class Widget
    {
        public int Value { get; set; }

        public int Double()
        {
            return Value * 2;
        }
    }
    ```
  </tab-item>
</tab-set>


### `charset = utf-8-bom`

```ini
charset = utf-8-bom
```

<tab-set>
  <tab-item title="Before">
    ```csharp
    namespace N;

    public class Widget
    {
        public int Value { get; set; }

        public int Double()
        {
            return Value * 2;
        }
    }
    ```
  </tab-item>

  <tab-item title="After">
    ```csharp
    namespace N;

    public class Widget
    {
        public int Value { get; set; }

        public int Double()
        {
            return Value * 2;
        }
    }
    ```
  </tab-item>
</tab-set>


### `charset = preserve`

```ini
charset = preserve
```

<tab-set>
  <tab-item title="Before">
    ```csharp
    namespace N;

    public class Widget
    {
        public int Value { get; set; }

        public int Double()
        {
            return Value * 2;
        }
    }
    ```
  </tab-item>

  <tab-item title="After">
    ```csharp
    namespace N;

    public class Widget
    {
        public int Value { get; set; }

        public int Double()
        {
            return Value * 2;
        }
    }
    ```
  </tab-item>
</tab-set>