# HTML Entity Issue

**URL:** <https://community.hubspot.com/t/html-entity-issue/137077>\
**Category:** CMS Development\
**Tags:** javascript, html\
**Created:** [July 29, 2025, 6:35pm UTC](https://community.hubspot.com/t/html-entity-issue/137077 "2025-07-29T18:35:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![BMaier](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bmaier/32/208325_2.png) [@BMaier](https://community.hubspot.com/u/BMaier)\
**Post date:** [July 29, 2025, 6:35pm UTC](https://community.hubspot.com/t/html-entity-issue/137077/1 "2025-07-29T18:35:03Z")

</div>

I’m having an odd issue where I can’t get an HTML Entity(registered trademark symbol ®) to render correctly.  
We are using the cms-react templates to build this site. This particular field is using a TextField for the heading and passing that field into an “Island” component that is renderened on load.  
This symbol renders properly locallly and ALSO in the preview when editing the page. However, when you view a preview of the page it renders as “\®”. Screenshots attached of the different scenarios.  
Is there something different I need to do? I can provide more links and code examples if needed but curious if anyone has run into this?

 ![Screenshot 2025-07-23 at 10.27.40 AM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/8/e/8edeb880870c5bb6fa39ea334ccf95e23c23a135.png)  
Live preview while editing. Works fine.  
 ![Screenshot 2025-07-23 at 10.28.13 AM.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/4/645b4cd9b6a2c15388dc74c7973aa4b963074166.png)  
Preview of the page, renders incorrectly.  
 ![Screenshot 2025-07-29 at 2.24.47 PM.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/1/a1746f745b40b2675838ab38e0e076d9b7cfe3b9.jpeg)  
Local development renders fine.

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [July 30, 2025, 10:51am UTC](https://community.hubspot.com/t/html-entity-issue/137077/2 "2025-07-30T10:51:06Z")

</div>

Hi @BMaier and welcome, we are so glad to have you here!  
Thanks for reaching out to the HubSpot Community and sharing screenshots, it is easier to understand.  
I’d love to put you in touch with our Top Experts and Community Members: Hi @nickdeckerdevs1, @ABainbridge, @KKuzmin, @mangelet and @Stephanie-OG do you have any tips to share with @BMaier, please?  
Have a great day and thanks so much in advance for your help!  
Bérangère

---

<div class="post-metadata">

**Author:** ![ABainbridge](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/abainbridge/32/86690_2.png) [@ABainbridge](https://community.hubspot.com/u/ABainbridge)\
**Post date:** [July 30, 2025, 11:05am UTC](https://community.hubspot.com/t/html-entity-issue/137077/3 "2025-07-30T11:05:40Z")

</div>

I couldn’t reproduce this. here’s my examples. I used Alt + 0174 for the registered icon

 ![ABainbridge_0-1753873219712.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/2/9/294e16b579c0dc24bb112590bb6947c7cbc2f9d5.png)

I then have my heading defined as this

We use a re-usable component for headings and descriptions on all of our modules  
```js

import PropTypes from ‘prop-types’;

import React from ‘react’;

import { getTextAlignClass, getTextColorClass } from ‘../../utilities/styleHelpers.js’;

const DynamicHeading = ({ headings }) =\> {

return (

\<div data-testid=“dynamicheading-container” id=“dynamicheading-div-1-1”\>

{headings?.map((item, index) =\> (

\<div

className={`${getTextAlignClass(item.heading\_align)} ${getTextColorClass(

item.heading\_color,

)}`}

key={item.heading}

data-testid={`dynamicheading-item-${index}`}

id={`dynamicheading-div-2-2-${index}`}

\>

{React.createElement(item.heading\_size, {}, item.heading)}

\</div\>

))}

\</div\>

);

};

DynamicHeading.displayName = ‘DynamicHeading’;

DynamicHeading.propTypes = {

headings: PropTypes.arrayOf(

PropTypes.shape({

heading: PropTypes.string.isRequired,

heading\_align: PropTypes.string,

heading\_color: PropTypes.string,

heading\_size: PropTypes.string.isRequired,

}),

).isRequired,

};

export default DynamicHeading;

```

this is inside of the fields file that is exported by my island, or rather the module that holds the island

```js

export const featureAuthoringGroup = {

type: ‘group’,

name: ‘featureAuthoringGroup’,

label: ‘Feature authoring form’,

expanded: true,

children: [

getDynamicHeadingField(‘featureAuthoring’),

getDynamicDescriptionField(‘featureAuthoring’),

],

};

```

then I have this helper function to get around issues with having the same field definitions within a single module. eg I can have headings and descriptions on a component, and then if there’s say a modal, I can give the modal it’s own heading and description

```js

/\*\*

\* Generates a HubSpot field group configuration for a dynamic heading component.

\* This group allows content editors to specify the heading text, size (H1-H6, P), color, and alignment.

\*

\* [@param](https://community.hubspot.com/t5/user/viewprofilepage/user-id/228859) {string} [headingIdPrefix=‘’] - An optional prefix to prepend to the IDs of the fields within the group.

\* Useful for ensuring uniqueness when this group is nested or repeated.

\* @returns {object} A HubSpot field group definition object.

\*/

export const getDynamicHeadingField = (headingIdPrefix = ‘’) =\> {

let prefix = headingIdPrefix;

if (prefix.length \> 0) {

prefix += ‘.’;

}

return {

children: [

{

allow\_new\_line: false,

default: ‘Enhanced User Experience’,

display\_width: null,

id: `${prefix}heading.heading`,

label: ‘Heading’,

locked: false,

name: ‘heading’,

required: false,

show\_emoji\_picker: false,

type: ‘text’,

validation\_regex: ‘’,

},

{

choices: [

[‘h1’, ‘H1’],

[‘h2’, ‘H2’],

[‘h3’, ‘H3’],

[‘h4’, ‘H4’],

[‘h5’, ‘H5’],

[‘h6’, ‘H6’],

[‘p’, ‘P’],

],

default: ‘h2’,

display: ‘select’,

display\_width: ‘half\_width’,

help\_text: ‘HTML heading size’,

id: `${prefix}heading.heading_size`,

label: ‘Size’,

locked: false,

multiple: false,

name: ‘heading\_size’,

preset: null,

reordering\_enabled: true,

required: true,

type: ‘choice’,

},

{

choices: colourChoices,

default: ‘primary’,

display: ‘select’,

display\_width: null,

id: `${prefix}heading.heading_color`,

label: ‘Color’,

locked: false,

multiple: false,

name: ‘heading\_color’,

preset: null,

reordering\_enabled: true,

required: true,

type: ‘choice’,

},

{

choices: [

[‘auto’, ‘Auto’],

[‘left’, ‘Left’],

[‘center’, ‘Center’],

[‘right’, ‘Right’],

],

default: ‘auto’,

display: ‘select’,

display\_width: null,

id: `${prefix}heading.heading_align`,

label: ‘Align’,

locked: false,

multiple: false,

name: ‘heading\_align’,

preset: null,

reordering\_enabled: true,

required: true,

type: ‘choice’,

},

],

display\_width: null,

expanded: false,

group\_occurrence\_meta: null,

id: `${prefix}heading`,

label: ‘Heading’,

locked: false,

name: ‘heading’,

occurrence: {

default: 0,

min: 0,

},

required: false,

tab: ‘CONTENT’,

type: ‘group’,

};

};

```

---

<div class="post-metadata">

**Author:** ![BMaier](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bmaier/32/208325_2.png) [@BMaier](https://community.hubspot.com/u/BMaier)\
**Post date:** [July 30, 2025, 2:07pm UTC](https://community.hubspot.com/t/html-entity-issue/137077/4 "2025-07-30T14:07:26Z")

</div>

This is what I’m experiencing as well. It shows up as expected when editing the page BUT when previewing the page or publishing the page it doesn not work. Can you confirm that?

---

<div class="post-metadata">

**Author:** ![ABainbridge](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/abainbridge/32/86690_2.png) [@ABainbridge](https://community.hubspot.com/u/ABainbridge)\
**Post date:** [July 30, 2025, 2:13pm UTC](https://community.hubspot.com/t/html-entity-issue/137077/5 "2025-07-30T14:13:53Z")

</div>

Look at the screenshot above the code examples. It’s working fine in that scenario with that code. you mentioned HTML Entity, what is this? you can use alt + numbers to do symbols like this that work

---

<div class="post-metadata">

**Author:** ![ABainbridge](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/abainbridge/32/86690_2.png) [@ABainbridge](https://community.hubspot.com/u/ABainbridge)\
**Post date:** [July 30, 2025, 4:18pm UTC](https://community.hubspot.com/t/html-entity-issue/137077/6 "2025-07-30T16:18:07Z")

</div>

Apologies. I didn’t see the “when published” bit previously. here’s my page after publishing and using alt + whatever number it was

 ![ABainbridge_0-1753892272115.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/c/fc33c49822597d60edd8b8fcf9c03aaac730e7c5.png)

---

<div class="post-metadata">

**Author:** ![KKuzmin](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@KKuzmin](https://community.hubspot.com/u/KKuzmin)\
**Post date:** [August 1, 2025, 7:26am UTC](https://community.hubspot.com/t/html-entity-issue/137077/7 "2025-08-01T07:26:40Z")

</div>

Hi. I solved the same problem using the “decode” method of the “he” library.

> **[GitHub - mathiasbynens/he: A robust HTML entity encoder/decoder written in...](https://github.com/mathiasbynens/he?tab=readme-ov-file#hedecodehtml-options)**
>
> A robust HTML entity encoder/decoder written in JavaScript.

For example

```lia-code-sample
import "he";

const heading = he.decode(tab.heading)

```

This should help with your problem.

---

<div class="post-metadata">

**Author:** ![BMaier](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/bmaier/32/208325_2.png) [@BMaier](https://community.hubspot.com/u/BMaier)\
**Post date:** [August 1, 2025, 2:39pm UTC](https://community.hubspot.com/t/html-entity-issue/137077/8 "2025-08-01T14:39:56Z")

</div>

Will try this!
