V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
raincious
V2EX  ›  反馈

或许不一定要在匹配 URL 的时候带上中文字符?

  •  
  •   raincious · 2015-09-15 13:23:14 +08:00 · 1914 次点击
    这是一个创建于 3150 天前的主题,其中的信息可能已经有所发展或是发生改变。
    比如这贴:
    https://www.v2ex.com/t/220720#r_2427082

    逗号被匹配成了 URL 的一部分。

    根据 RFC2396 http://www.ietf.org/rfc/rfc2396.txt (参考 http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html )中的 2.1 URI and non-ASCII characters :

    In the simplest case, the original character sequence contains only
    characters that are defined in US-ASCII, and the two levels of
    mapping are simple and easily invertible: each 'original character'
    is represented as the octet for the US-ASCII code for it, which is,
    in turn, represented as either the US-ASCII character, or else the
    "%" escape sequence for that octet.

    当然下文还提到一个复杂情况的。但是鉴于浏览器会在复制非 ASCII 字符的时候自动进行% escape ,那么其实也就几乎可以忽略那个“复杂情况”了。
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   991 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:17 · PVG 07:17 · LAX 16:17 · JFK 19:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.