Content Builder blocks containing AMPScript may improperly parse script as HTML
Trailblazer Community

Content Builder blocks containing AMPScript may improperly parse script as HTML

Marketing Cloud Email Studio

Last updated 2019-05-31 ·Reference W-4276113 ·Reported By 38 users

Fixed in version Marketing Cloud January 2018

Summary
When editing Content Builder blocks that contain AMPScript, some characters may be improperly parsed as if they were HTML.

This can result in aberrant behavior, including unexpected output from the script and/or syntax errors.

Some examples, not exhaustive:

-the sequence &reg is rendered as the registered trademark symbol

-the less than operator is treated as an opening character for an HTML tag, and autocompleted with the closing character and closing tag (example below)

-code between double-percentage symbols is removed upon saving the content

Example:

AMPScript code added to content block during edit =
IF @var < 10 THEN

Resulting content saved from above =
IF @var <10></10> THEN

Note: some behavior may be obscured from the UI layer but will manifest as validation errors or pages failing to load

Note: some behavior may only occur with specific block types, e.g.: Free Form

Repro
1. Access Email Studio or CloudPages
2. Create, Edit, or retrieve saved Content Block content via Content Builder editor
3. Paste or write AMPScript into Content Block
4. Save block
5. (this varies depending upon specific scenario) Reopen block or attempt send/publish using content

Workaround
There are a few different options to work around this behavior:

A) Utilize Code Snippet type content blocks, note that inclusion of the Code Snippet may require surrounding table tags in the HTML for some use cases.

B) Store the AMPScript in a saved content block and introduce to the desired email, page via ContentBlockByName() AMPScript function (or equivalent)

C) Utilize the Classic Editor in place of Content Builder

Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.