analytics
analytics copied to clipboard
International Domain Names (IDN) Support
Changes
This PR adds support for IDNs as discussed in #993. I replaced the latin alphanumeric validation with a more broad one, supporting other alphabets. I also made some changes to URI encoding to make sure our URLs are still good looking.
Tests
- [X] Automated tests have been added
Changelog
- [X] Entry has been added to changelog
Documentation
- [X] This change does not need a documentation update
Dark mode
- [X] The UI has been tested both in dark and light mode
BundleMon
Unchanged files (7)
Status | Path | Size | Limits |
---|---|---|---|
:white_check_mark: | static/css/app.css |
515.19KB | - |
:white_check_mark: | static/js/dashboard.js |
295.63KB | - |
:white_check_mark: | static/js/app.js |
12.13KB | - |
:white_check_mark: | static/js/embed.host.js |
5.58KB | - |
:white_check_mark: | static/js/embed.content.js |
5.06KB | - |
:white_check_mark: | tracker/js/plausible.js |
748B | - |
:white_check_mark: | static/js/applyTheme.js |
314B | - |
No change in files bundle size
Final result: :white_check_mark:
View report in BundleMon website ➡️
@vinibrsl nice! for marketing/communication purposes: when this is merged, we will support any character for the domain name? or this adds support for some specific international characters only? basically need to know what to communicate to people
@vinibrsl nice! for marketing/communication purposes: when this is merged, we will support any character for the domain name? or this adds support for some specific international characters only? basically need to know what to communicate to people
@metmarkosaric this pull request adds support for any Unicode character in the "letter" category, not any character. In other words, a letter in any language. Plus numbers, dots, and slashes.
I've always thought the techincal debt we have is not using the Phoenix Route helpers which automatically url-encode your params. So instead of:
|> redirect(to: "/#{URI.encode_www_form(site.domain)}/settings/danger-zone")
We could do
|> redirect(to: Routes.site_path(conn, :settings_danger_zone, site.domain))
But I think the behaviour between them is exactly the same
The PR looks good overall!
The new encoding function is used in a couple places but there are many many more places where we encode domains. Try running
git grep 'URI.encode_www_form'
in the project to see all of them.I need some convincing in the first place that the old function isn't going to work:
iex(7)> URI.encode_www_form("wèbsite.com/wat") "w%C3%A8bsite.com%2Fwat"
When I paste this into the browser, I get:
Which looks correct to me. So maybe we don't need to re-do the encoding?
You're right, we don't need the new encoding function for the URLs to work. However, there are two places where the escaped URL is displayed: (1) dashboard visibility toggle and (2) shared links. Here's how they look without the new function:

At least for the visibility toggle we should have some kind of escaping. I moved the new function to be used only in that view (d49fb6a29797f571453515967b6d9c17dba23400). Based on your suggestion I also changed Phoenix links and buttons to the generated Routes
functions in that same view (31775fc54330b2128467972b227a9e68dedea06b). Here's how it's looking:
