Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support emojis inside short links #767

Closed
ayr-ton opened this issue May 14, 2020 · 5 comments · Fixed by #1319
Closed

Support emojis inside short links #767

ayr-ton opened this issue May 14, 2020 · 5 comments · Fixed by #1319
Labels
Milestone

Comments

@ayr-ton
Copy link

ayr-ton commented May 14, 2020

Summary

Today emojis are mostly UTF-8 chars, so is possible to put them in links like:

https://blog.rebrandly.com/add-emojis-to-short-links/

So, a great feature would be allowing UTF-8 chars inside the custom shortlink box and let the UTF-8 magic to happen. 🤸🏻‍♂️


This requires changes in the database too, as current collation (utf8 instead of utf8mb4) does not support all emojis.

@acelaya
Copy link
Member

acelaya commented May 14, 2020

Sounds like something nice to have.

I will investigate the effort required to implement this.

@acelaya acelaya added this to the 2.3.0 milestone May 31, 2020
@acelaya acelaya added the feature label Jun 6, 2020
@acelaya
Copy link
Member

acelaya commented Aug 9, 2020

Hey @ayr-ton, I'm afraid I have to move this out of v2.3.0

It's turning out way more complex than I anticipated. Currently, the reason for which emojis are not supported is because when you provide a custom slug, it is filtered and normalized, applying a regex which only allows a-z, A-Z, 0-9 and a few special characters which are valid for URLs, like ., _ or ~. Everything else is replaced by a dash (-).

In order to support emojis, the unicode sequences of all known emojis have to be added to this regular expression. I more or less figured that out, but the problem is that it has to be negated (at the end the regex defines what's allowed, and everything else needs to be replaced), and it's not working as expected.

I have also considered completely changing the approach, and allow any character in custom slugs but spaces, but that might potentially introduce some breaking change and nasty edge case that needs to be carefully tested.

Because of that I will delay this a bit more, to avoid blocking the release of v2.3 any further, and spend a bit more time testing/investigating afterwards.

@acelaya acelaya removed this from the 2.3.0 milestone Aug 9, 2020
@ayr-ton
Copy link
Author

ayr-ton commented Aug 10, 2020

Thanks for all the details, @acelaya

Looking forward to future versions o/

@acelaya acelaya added this to the 2.7.0 milestone Nov 24, 2020
@acelaya acelaya modified the milestones: 2.7.0, 2.8.0 May 9, 2021
@acelaya acelaya removed this from the 2.8.0 milestone Jul 13, 2021
@acelaya acelaya added this to the 3.1.0 milestone Jan 7, 2022
@acelaya
Copy link
Member

acelaya commented Jan 10, 2022

I have made some progress on supporting emojis in Shlink. Basically, I have simplified how custom slugs are processed, allowing any character but " " and "/". That effectively allows using emojis in the custom slug. More can be seen in #1318

However, there's still two other things to tackle.

  • When persisiting emojis, there are som contexts in which there's a database error. It doesn't happen always, so I'm trying to find out what's the reason.
  • When using an emoji as a custom slug, it is being URL-encoded somewhere, "breaking" it in some way. I'm investigating this too.

@acelaya acelaya modified the milestones: 3.1.0, 3.0.0 Jan 10, 2022
@acelaya
Copy link
Member

acelaya commented Jan 10, 2022

Support for emojis fully implemented now 😎. It will be released with Shlink 3.0.0

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants