How to handle diacritics (accents) when rewriting 'pretty URLs'

前端 未结 6 803
长情又很酷
长情又很酷 2020-11-30 09:48

I rewrite URLs to include the title of user generated travelblogs.

I do this for both readability of URLs and SEO purposes.

 http://www.example.com/gall         


        
6条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 10:32

    Now people can write titles containing any UTF-8 character, but most are not allowed in the URL.

    On the contrary, most are allowed. See for example Wikipedia's URLs - things like http://en.wikipedia.org/wiki/Café (aka http://en.wikipedia.org/wiki/Caf%C3%A9) display nicely - even if StackOverflow's highlighter doesn't pick them out correctly :-)

    The trick is reading them reliably across any hosting environment; there are problems with CGI and Windows servers, particularly IIS, for example.

提交回复
热议问题