-
Notifications
You must be signed in to change notification settings - Fork 26
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
IDN support #85
Comments
see also misskey-dev/misskey#5826 |
今の仕様ではメンションのホスト名には非ASCII文字は直接使用できません。 ホスト名の部分をUnicodeでも記述できるように変更するということですかね? |
Yes, when parsing Unicode should be understood. But I think it would make sense if the output contains punycoded domains if necessary.
⇓
|
I looked to Mastodon how they are doing it, and these are the regular expressions they use to recognize a mention: USERNAME_RE = /[a-z0-9_]+([a-z0-9_\.-]+[a-z0-9_]+)?/i
MENTION_RE = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]\.\-]+[[:word:]]+)?)/i Since pegjs does not support Mastodon's regular expression for mentions translates to Javascript as (replacing /(?<=^|[^\/\p{L}\p{N}_])@[a-z0-9_]+(?:[a-z0-9_\.-]+[a-z0-9_]+)?(?:@[\p{L}\p{N}_\.-]+[\p{L}\p{N}_]+)?/iu |
IDN (International Domain Name) is not yet implemented in parsing domain names.
However, there is the concern that it can break existing posts for example the following could be parsed incorrectly:
An idea would be to recognize IDNs only if there is a space after it, but it might not always work.
I am not sure how to best solve this, but I think not implementing IDNs is a very inelegant solution that needs to be fixed. I have already seen a few people that were irritated by the missing proper support for IDNs.
The text was updated successfully, but these errors were encountered: