chainchan
V2EX  ›  问与答

有谁能告诉我这是什么编码?

  •  
  •   chainchan · Apr 26, 2012 · 3822 views
    This topic created in 5305 days ago, the information mentioned may be changed or developed.
    %E5%88%B0%E6%AD%A4%E4%B8%80%E6%B8%B8%2C+%E5%BF%83%E6%83%85%E5%A6%82%E4%BD%95..

    记得查wiki的时,如果你复制一个连接,后面的中文字符就会变成类似上述的编码。
    请问如何进行转换?我应该看哪些方面的知识,谢谢
    7 replies  •  1970-01-01 08:00:00 +08:00
    eerie
    eerie
    Apr 26, 2012
    2
    urlencode
    lianghai
    lianghai
    Apr 26, 2012
    3
    另外,维基百科 URL 里的 percent-encoding 是由 UTF-8 转出的。
    benzhe
    benzhe
    Apr 26, 2012
    5
    url 里的就叫 url encode , javascript 就有相关加解码函数:

    decodeURI("%E5%88%B0%E6%AD%A4%E4%B8%80%E6%B8%B8%2C+%E5%BF%83%E6%83%85%E5%A6%82%E4%BD%95..");
    clino
    clino
    Apr 26, 2012
    6
    看起来是 utf8 进行 quote 以后得到的

    Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import urllib
    >>> print urllib.unquote("%E5%88%B0%E6%AD%A4%E4%B8%80%E6%B8%B8%2C+%E5%BF%83%E6%83%85%E5%A6%82%E4%BD%95")
    到此一游,+心情如何
    >>>
    reus
    reus
    Apr 26, 2012
    7
    +号要转成空格
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5047 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 59ms · UTC 06:24 · PVG 14:24 · LAX 22:24 · JFK 01:24
    ♥ Do have faith in what you're doing.