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

URLに使用できる記号の検討 #100

Open
marihachi opened this issue Feb 27, 2022 · 2 comments
Open

URLに使用できる記号の検討 #100

marihachi opened this issue Feb 27, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@marihachi
Copy link
Contributor

marihachi commented Feb 27, 2022

URLに使用できても良さそうな記号がいくつかあるので検討したい。

検討対象(ASCII):

  • '
  • *
  • ;

一応、上記の記号はRFC 3986にReserved, Unreservedとして規定されている。
つまりURLとして使用できる?あまり自信はない。

Related

@marihachi marihachi added the enhancement New feature or request label Feb 27, 2022
@Johann150
Copy link
Contributor

Semicolons (;) definitely occur in URLs, for example gitweb uses them in URLs like https://git.qwertqwefsday.eu/?p=agate.git;a=summary

For the others I think we should look towards existing Markdown standards (see also misskey-dev/misskey#8011). On GitHub both of those seem to be recognized as parts of URLs:

https://example.com/ho'ni
https://example.com/ho*ni

However not at the start or end:

'https://example.com/honi
*https://example.com/honi

https://example.com/honi'
https://example.com/honi*

@esperecyan
Copy link

CommonMark標準仕様における自動リンクは、< > で囲まれたURLにはリンクしますが、URLのみの場合は単なるテキストとして扱われます。
https://spec.commonmark.org/0.30/#example-610
ただし、広く使われているライブラリを利用し、広く使われている独自拡張に準拠することは意味があると思います。

RFC 3986はURL Standardにより廃用とされており、現実的にも後者を参照した方が良さそうです。
https://triple-underscore.github.io/URL-ja.html

同仕様においては、文章中のどの範囲をURLをみなすかといったことは定義されておらず、たいていの記号は解析時にパーセント符号化されます。そこで、解析器にかけたときに、強制的にパーセント符号化される記号は、URLに使えない記号であるとみなすと考えた場合に、検討対象のそれぞれの文字がURLのどこでつかえるかとまとめると、以下のようになりました。

記号 URLのどこで使えるか
' クエリ ※1
* URLでは使えない
; URLでは使えない

※1 スキームがftp, file, http, https, ws, wssの場合のみ

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

No branches or pull requests

3 participants