Should I use accented characters in URLs?

后端 未结 5 608
我寻月下人不归
我寻月下人不归 2020-12-01 02:31

When one creates web content in languages different than English the problem of search engine optimized and user friendly URLs emerge.

I\'m wondering whether it is t

5条回答
  •  抹茶落季
    2020-12-01 03:23

    There's no ambiguity here: RFC3986 says no, that is, URIs cannot contain unicode characters, only ASCII.

    An entirely different matter is how browsers represent encoded characters when displaying a URI, for example some browsers will display a space in a URL instead of '%20'. This is how IDN works too: punycoded strings are encoded and decoded by browsers on the fly, so if you visit café.com, you're really visiting xn--caf-dma.com. What appears to be unicode chars in URLs is really only 'visual sugar' on the part of the browser: if you use a browser that doesn't support IDN or unicode, the encoded version won't work because the underlying definition of URLs simply doesn't support it, so for it to work consistently, you need to % encode.

提交回复
热议问题