> For the complete documentation index, see [llms.txt](https://upsolver.gitbook.io/content/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upsolver.gitbook.io/content/articles-1/data/field-name-encoding.md).

# Field Name Encoding

Upsolver ensures compatibility with various target systems, including those that have specific restrictions on field names, such as Avro. This document outlines how Upsolver handles field name encoding in AVRO and Parquet files, ensuring the proper encoding and representation of field names.

## Avro Field Name Restrictions

Avro imposes specific restrictions on field names, which must:

* Start with characters `[A-Za-z_]`
* Subsequently contain only `[A-Za-z0-9_]`

## Upsolver's Encoding Strategy

To support any Unicode character in field names, Upsolver encodes these names. Moreover, for targets with case-insensitive column names such as Amazon Athena, Upsolver encodes uppercase characters.

The user generally will not see these encoded names in the target system but may encounter them in intermediate files or if looking directly at the source files.

{% hint style="info" %}
Only fields containing unsupported characters are encoded.
{% endhint %}

## Encoding Pattern

An encoded field starts with `x_`, and every encoded character is represented as `_<char-code>_`.

## Example

Consider the following original data:

```json
{
    "l": 1,
    "b": true,
    "s": "str",
    "d": 3.2,
    "a.b": "a.b",
    "C.d": "C.d",
    "x_": "x_",
    "x_a": "x_a"
}
```

When converted to a Parquet file for use in Athena (which is case insensitive), it will be encoded as follows:

```json
{
  "l": 1,
  "b": true,
  "s": "str",
  "d": 3.2,
  "x_a_2e_b": "a.b",
  "x_c_2e_d": "C.d",
  "x_x_5f_": "x_",
  "x_x_5f_a": "x_a"
}
```

This encoding ensures that the field names comply with the restrictions while preserving the original field names within the data content, thereby maintaining consistency and compatibility across different systems. In Athena, the table/view definition will name the columns by their original unencoded name.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://upsolver.gitbook.io/content/articles-1/data/field-name-encoding.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
