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

implement IDN mentions #86

Closed
wants to merge 0 commits into from
Closed

Conversation

Johann150
Copy link
Contributor

What

Mentions containing an IDN are now also correctly recognized.

There are some heuristics when something is IDN or when it is text: If the text matches the regular expression described in the issue it is considered as an IDN mention. But if the start of the suspected hostname matches as an ASCII-only hostname, I do not consider it as an IDN mention. This leads to @[email protected]こんいちは being recognized as before:

[MENTION('someone', 'example.com', '@[email protected]'), TEXT('こんいちは')]

The host field of mentions will contain punycode domains because it is intended for the server to process. The acct field of mentions contains names with Unicode domains because it is intended for clients to display. (This will apply even if the punycoded domain was typed in manually!)

Why

fix #85

@codecov
Copy link

codecov bot commented Nov 11, 2021

Codecov Report

Merging #86 (4e41913) into develop (051e903) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #86      +/-   ##
===========================================
+ Coverage    99.62%   99.66%   +0.03%     
===========================================
  Files            4        4              
  Lines          531      590      +59     
  Branches       106      111       +5     
===========================================
+ Hits           529      588      +59     
+ Misses           2        1       -1     
- Partials         0        1       +1     
Impacted Files Coverage Δ
src/api.ts 100.00% <100.00%> (ø)
src/internal/util.ts 99.18% <100.00%> (+0.19%) ⬆️
src/node.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 051e903...4e41913. Read the comment docs.

@Johann150
Copy link
Contributor Author

I'm not sure that level of correctness would be necessary for the complexity it introduces, but I added the external IDNA regex.

@Johann150
Copy link
Contributor Author

I'm unsure if its right that the acct should contain the punycode domain.

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

Successfully merging this pull request may close these issues.

IDN support
1 participant