GhostFlying
V2EX  ›  问与答

GMail API 的返回值是什么编码?

  •  
  •   GhostFlying · Dec 1, 2014 · 2414 views
    This topic created in 4348 days ago, the information mentioned may be changed or developed.
    邮件原文是

    <div dir="ltr">test</div>

    经过 base 64 编码后是

    PGRpdiBkaXI9Imx0ciI+dGVzdDwvZGl2Pg==

    但是 GMail API 的返回是

    PGRpdiBkaXI9Imx0ciI-dGVzdDwvZGl2Pg0K

    相差非常细微,求问是什么编码,或者是什么 base64 的变形?
    3 replies  •  2014-12-01 01:08:05 +08:00
    GhostFlying
        1
    GhostFlying  
    OP
       Dec 1, 2014
    找到答案了,URL_SAFE 模式,用 - 和 _ 替换了 + 和 /, 然后进行的 base64 编码
    GhostFlying
        2
    GhostFlying  
    OP
       Dec 1, 2014
    @GhostFlying 说错了。。先编码再替换
    GhostFlying
        3
    GhostFlying  
    OP
       Dec 1, 2014
    继续犯2,重新补充下

    就是用的 URL_SAFE 的 base64 编码,然后替换原文里的 " 为 ',并且结尾有 \r\n
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2018 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 16:45 · PVG 00:45 · LAX 09:45 · JFK 12:45
    ♥ Do have faith in what you're doing.