# Special characters encoding issue in onboarding tips

**URL:** https://meta.discourse.org/t/special-characters-encoding-issue-in-onboarding-tips/352169
**Category:** Translations
**Created:** [February 13, 2025, 10:28pm UTC](https://meta.discourse.org/t/special-characters-encoding-issue-in-onboarding-tips/352169 "2025-02-13T22:28:57Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [February 13, 2025, 10:28pm UTC](https://meta.discourse.org/t/special-characters-encoding-issue-in-onboarding-tips/352169/1 "2025-02-13T22:28:57Z")

</div>

See the button:

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/f/f/3ff5e402e6e802a9be3098d4faa1bc6a948c78e5.png)

I wouldn’t be surprised if the issue was present inall the tooltips.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [February 17, 2025, 7:08pm UTC](https://meta.discourse.org/t/special-characters-encoding-issue-in-onboarding-tips/352169/2 "2025-02-17T19:08:23Z")

</div>

I stumbled on the same issue.

A quick look to Discourse shows that `escape` is used on the button label, title and content.

[https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/user-tip.gjs#L38-L39](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/user-tip.gjs#L38-L39)

[https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/user-tip.gjs#L54-L58](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/user-tip.gjs#L54-L58)

What does `escape`:  
[https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/lib/escape.js](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/lib/escape.js)

In a text context, this seems all valid characters to use.

I wonder, is it required here?  
I believe html not marked with `htmlSafe` will be escaped by the template? 🤔

---

<div class="post-metadata">

### Author: ![pequiste](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pequiste/32/490888_2.png) [@pequiste](https://meta.discourse.org/u/pequiste)
#### Post date: [March 6, 2025, 5:27am UTC](https://meta.discourse.org/t/special-characters-encoding-issue-in-onboarding-tips/352169/3 "2025-03-06T05:27:39Z")

</div>

A fix could be to replace the programming apostrophe with the actual French apostrophe.

Use: `’`  
Not: `'`

This symbol does not exist on US QWERTY keyboards and does not exist either on older AZERTY ones but it does exist on both new AFNOR (Association française de normalisation) standard French keyboards, either [new AZERTY](https://norme-azerty.fr/) or [BÉPO](https://bepo.fr).

It wouldn’t fix the deeper issue that the programmatic apostrophe is not correctly escaped, but the real French apostrophe is the correct one to use and should be the one most French speakers will use in typing once a majority of them will be on standard keyboards.

The old AZERTY was never actually standardized by any official body.

---

<div class="post-metadata">

### Author: ![evenlo](https://avatars.discourse-cdn.com/v4/letter/e/4bbf92/32.png) [@evenlo](https://meta.discourse.org/u/evenlo)
#### Post date: [March 21, 2025, 2:14am UTC](https://meta.discourse.org/t/special-characters-encoding-issue-in-onboarding-tips/352169/4 "2025-03-21T02:14:07Z")

</div>

Got same issue on Discourse 3.4.1 …  
I can’t possibly replace all the `'` on the website. Do you have any suggestions?

 ![The image is a notification from Noetic AI showing progress in subject chronology analysis, with 5/8 tasks completed and an estimated time of 18 minutes remaining. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/a/f/4/af48e0b1b675e01d1d3bb4315be9ba0f9011504a.png)

---

<div class="post-metadata">

### Author: ![evenlo](https://avatars.discourse-cdn.com/v4/letter/e/4bbf92/32.png) [@evenlo](https://meta.discourse.org/u/evenlo)
#### Post date: [March 21, 2025, 3:08am UTC](https://meta.discourse.org/t/special-characters-encoding-issue-in-onboarding-tips/352169/5 "2025-03-21T03:08:22Z")

</div>

I just fixed thiss issue with some custom code, replace `'` to `’` in ` I18n.translations`

```js
withPluginApi("0.8.18", (api) => {
    const locale = I18n.currentLocale();

    function replaceSingleQuotes(obj) {
        if (typeof obj === 'string') {
            // Split the string into HTML tags and non-tag parts
            return obj.split(/(<[^>]+>)/g).map(segment => {
                // If the segment is an HTML tag, do not replace anything
                if (segment.startsWith('<') && segment.endsWith('>')) {
                    return segment;
                } else {
                    // Replace single quotes only in non-HTML parts
                    return segment.replace(/'/g, '’');
                }
            }).join('');
        } else if (typeof obj === 'object' && obj !== null) {
            // Recursively process object properties
            for (const key in obj) {
                obj[key] = replaceSingleQuotes(obj[key]);
            }
        }
        return obj;
    }

    if (I18n.translations[locale].js) {
        I18n.translations[locale].js = replaceSingleQuotes(I18n.translations[locale].js);
    }
});

```

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [August 7, 2025, 5:46pm UTC](https://meta.discourse.org/t/special-characters-encoding-issue-in-onboarding-tips/352169/6 "2025-08-07T17:46:57Z")

</div>

This should be fixed now following this commit: [FIX: user tips in languages with apostrophes by pmusaraj · Pull Request #34118 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/34118)

Thanks for the report!

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [August 11, 2025, 12:00pm UTC](https://meta.discourse.org/t/special-characters-encoding-issue-in-onboarding-tips/352169/7 "2025-08-11T12:00:57Z")

</div>

This topic was automatically closed after 3 days. New replies are no longer allowed.
