# In onebox, \`&\` become \`&amp;\`

**URL:** https://meta.discourse.org/t/in-onebox-become-amp/59153
**Category:** Support
**Created:** [March 15, 2017, 1:12pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153 "2017-03-15T13:12:25Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![CamilleRoux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/camilleroux/32/119575_2.png) [@CamilleRoux](https://meta.discourse.org/u/CamilleRoux)
#### Post date: [March 15, 2017, 1:12pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/1 "2017-03-15T13:12:25Z")

</div>

I’m using the Discourse Affiliate plugin to add some params to URL. When the URL is used in plain text or in a link, everything is ok. But when it’s transformed in onebox, the `&` become `&amp;`  
 ![](https://global.discourse-cdn.com/meta/optimized/3X/1/7/17dd4f272d38c6f861dbfe897434a2861ef8e23b_2_690x40.png)

Do you know why?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [March 15, 2017, 1:21pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/2 "2017-03-15T13:21:26Z")

</div>

So the URL will be valid?

> **[List of Validator errors and their explanation - Error Explanations for The W3C...](https://validator.w3.org/docs/errors.html#hasverbose)**
>
> Below are all the validator's error messages for which we have an "explanation". | W3C's easy-to-use
> markup validation service, based on SGML and XML parsers.

> This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text.

---

<div class="post-metadata">

### Author: ![CamilleRoux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/camilleroux/32/119575_2.png) [@CamilleRoux](https://meta.discourse.org/u/CamilleRoux)
#### Post date: [March 15, 2017, 1:26pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/3 "2017-03-15T13:26:56Z")

</div>

Whatever, it’s more readable if & are used instead of & I think…

Is it a Onebox bug ?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [March 15, 2017, 2:00pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/4 "2017-03-15T14:00:26Z")

</div>

To me it isn’t a bug at all. The URL is being shown in the correct format.

---

<div class="post-metadata">

### Author: ![CamilleRoux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/camilleroux/32/119575_2.png) [@CamilleRoux](https://meta.discourse.org/u/CamilleRoux)
#### Post date: [March 15, 2017, 2:05pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/5 "2017-03-15T14:05:11Z")

</div>

When I click on it it’s still `https://www.captaincontrat.com/articles-financement-societe/etapes-convention-actionnaires?utm_source=pragmatic&amp;utm_medium=referral&amp;utm_content=link` in the browser (exemple [here](https://forum.pragmaticentrepreneurs.com/t/forcer-limplication-dun-associe-non-salarie-dans-le-pacte-dassocies/8379/2?u=camilleroux)

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [March 15, 2017, 2:10pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/6 "2017-03-15T14:10:51Z")

</div>

That URL works for me.

[https://www.captaincontrat.com/articles-financement-societe/etapes-convention-actionnaires?utm\_source=pragmatic&amp;utm\_medium=referral&amp;utm\_content=link](https://www.captaincontrat.com/articles-financement-societe/etapes-convention-actionnaires?utm_source=pragmatic&amp;utm_medium=referral&amp;utm_content=link)

The example “here” link however opens the Discourse app.

I have a feeling this topic is more about the app than oneboxed?

---

<div class="post-metadata">

### Author: ![CamilleRoux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/camilleroux/32/119575_2.png) [@CamilleRoux](https://meta.discourse.org/u/CamilleRoux)
#### Post date: [March 15, 2017, 2:13pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/7 "2017-03-15T14:13:24Z")

</div>

We can see `&amp;amp;` instead of `&` in the URL now…  
 ![](https://global.discourse-cdn.com/meta/optimized/3X/8/0/807d80d39dbd680e181fc166b82e7428e15c19d5_2_690x28.png)

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [March 15, 2017, 2:20pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/8 "2017-03-15T14:20:08Z")

</div>

Yes, it can be confusing. Maybe you’ve had coding experience where backslash escapes needed to be backslash escaped themselves?

This is similar. Because the ampersand that signals the beginning of an entity is an entity itself, it “doubles up”

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [March 15, 2017, 6:10pm UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/9 "2017-03-15T18:10:16Z")

</div>

Maybe you should URL encode the ampersands in a URL context?

> **[Percent-encoding](https://en.wikipedia.org/wiki/Percent-encoding)**
>
> Percent-encoding, also known as URL encoding, is a method to encode arbitrary data in a uniform resource identifier (URI) using only the US-ASCII characters legal within a URI. Percent-encoding is used to ensure special characters do not interfere with the URI's structure and interpretation. Special characters are replaced with a percent sign (%) followed by two hexadecimal digits representing the character's byte value. For example, a space is commonly encoded as %20:
> Although it is known as UR...

`&` &nbsp; ➡ &nbsp; `%26`

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 14, 2019, 5:23am UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/10 "2019-05-14T05:23:12Z")

</div>



---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 14, 2019, 5:50am UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/11 "2019-05-14T05:50:09Z")

</div>

I think we actually fixed this @techAPJ?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [May 14, 2019, 5:57am UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/12 "2019-05-14T05:57:36Z")

</div>

Yes, this issue was fixed back in December 2017 via [this commit](https://github.com/discourse/onebox/commit/3b784ba85257c91f1c6ee839087733ec78616fd5)… but we now have a much better and stable fix in place:

[https://github.com/discourse/onebox/commit/7a1885c48800693d9d4abfa9c58d6d25fd19ca65](https://github.com/discourse/onebox/commit/7a1885c48800693d9d4abfa9c58d6d25fd19ca65)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 14, 2019, 5:57am UTC](https://meta.discourse.org/t/in-onebox-become-amp/59153/13 "2019-05-14T05:57:45Z")

</div>


