# Character Encoding in Advar Responses

When special characters are used in creative field values, the Adhese ad response (advars) does not always return them as-is. This page describes the current encoding behavior so integrators can correctly process the `ad.tag` property and display these values.

### Character processed without change

`! @ # $ % ^ * ( ) : ; | ? / , . ~ ``

### Always entity-encoded

Regardless of account configuration, the following characters are always encoded:

<table class="code-line" dir="auto" id="bkmrk-character-name-encod" style="width: 39.5238%;"><thead class="code-line" dir="auto"><tr class="code-line" dir="auto"><th class="align-left" style="width: 29.8764%;">character</th><th class="align-left" style="width: 36.7445%;">name</th><th class="align-left" style="width: 33.3104%;">encoded as</th></tr></thead><tbody class="code-line" dir="auto"><tr class="code-line" dir="auto"><td style="width: 29.8764%;">`&`</td><td style="width: 36.7445%;">ampersand</td><td style="width: 33.3104%;">`&amp;`</td></tr><tr class="code-line" dir="auto"><td style="width: 29.8764%;">`"`</td><td style="width: 36.7445%;">double quote</td><td style="width: 33.3104%;">`&quot;`</td></tr></tbody></table>

<table class="code-line" dir="auto" id="bkmrk-example%3A-encoding-%22a" style="width: 39.881%;"><thead class="code-line" dir="auto"><tr class="code-line" dir="auto"><th class="align-left" style="width: 30.8234%;">example:</th><th class="align-left" style="width: 69.1167%;">encoding</th></tr></thead><tbody class="code-line" dir="auto"><tr class="code-line" dir="auto"><td class="align-left" style="width: 30.8234%;">"Abc" K&amp;L</td><td class="align-left" style="width: 69.1167%;">`&quot;Abc&quot; K&amp;L`</td></tr></tbody></table>

### Single quote: controlled by the `escapeAdvarStrategy` setting

How a single quote (`'`) is encoded depends on the account's `escapeAdvarStrategy` configuration property. This property exists because a single, universal escaping approach doesn't work for every delivery format:

- the HTML entity `&rsquo;` only decodes correctly in HTML contexts
- in native or JSON tags it would otherwise show up to the end user as literal entity text.

<table class="code-line" dir="auto" id="bkmrk-value-of-escapeadvar" style="width: 100%;"><thead class="code-line" dir="auto"><tr class="code-line" dir="auto"><th class="align-left" style="width: 20.734%;">value of  
`escapeAdvarStrategy`  
</th><th class="align-left" style="width: 61.6056%;">behavior</th><th class="align-left" style="width: 17.6365%;">example:   
`O'Brien`</th></tr></thead><tbody class="code-line" dir="auto"><tr class="code-line" dir="auto"><td style="width: 20.734%;">`raw`</td><td style="width: 61.6056%;">No escaping — the quote is passed through as-is</td><td style="width: 17.6365%;">`O'Brien`</td></tr><tr class="code-line" dir="auto"><td style="width: 20.734%;">`html`</td><td style="width: 61.6056%;">HTML-entity escaping</td><td style="width: 17.6365%;">`O&rsquo;Brien`</td></tr><tr class="code-line" dir="auto"><td style="width: 20.734%;">`accent`</td><td style="width: 61.6056%;">The quote is replaced with an acute accent (`´`) — a visual substitution, not a true escape</td><td style="width: 17.6365%;">`O´Brien`</td></tr></tbody></table>

**Fallback:** if `escapeAdvarStrategy` is unset, blank, or set to an unrecognized value, the account falls back to its legacy `escapeAdvarParams` boolean: `false` behaves like `raw`, and `true` (the default) behaves like `html`.

Accounts that haven't set `escapeAdvarStrategy` are unaffected and continue to behave exactly as before.

Integrators should decode a value according to the account's configured strategy before displaying it. For an account using `html` (the default), a value containing `T&T` is returned as `T&amp;T` and should be decoded back to `T&T`; a value containing `O'Brien` is returned as `O&rsquo;Brien` and should be decoded back to `O'Brien`.

### Unsupported characters

The following characters currently cannot be saved in a creative field:

<table class="code-line" dir="auto" id="bkmrk-character-name-behav" style="width: 78.8095%;"><thead class="code-line" dir="auto"><tr class="code-line code-active-line" dir="auto"><th class="align-left" style="width: 14.9766%;">character</th><th class="align-left" style="width: 23.8921%;">name</th><th class="align-left" style="width: 61.101%;">behavior</th></tr></thead><tbody class="code-line" dir="auto"><tr class="code-line" dir="auto"><td style="width: 14.9766%;">`\`</td><td style="width: 23.8921%;">backslash</td><td style="width: 61.101%;">Results in a malformed value in the ad response</td></tr><tr class="code-line" dir="auto"><td style="width: 14.9766%;">`<`</td><td style="width: 23.8921%;">less than sign</td><td style="width: 61.101%;">Not accepted when saving the creative</td></tr><tr class="code-line" dir="auto"><td style="width: 14.9766%;">`>`</td><td style="width: 23.8921%;">more than sign</td><td style="width: 61.101%;">Not accepted when saving the creative</td></tr></tbody></table>

<p class="callout danger">Don't use these characters in field values!</p>

### Note

Encoding behavior is subject to change; this page will be updated if the rules above change.