V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
somehand
V2EX  ›  问与答

请教, curl windows 下使用中文参数乱码的问题。

  •  
  •   somehand · Apr 3, 2020 via Android · 2630 views
    This topic created in 2215 days ago, the information mentioned may be changed or developed.

    用 Android studio 下上传安装包到蒲公英,使用公开接口用 curl 上传,其中应用名和描述是中文,这时候传上去蒲公英平台显示乱码,上传结果的 response 里的应用名和描述也已经是乱码了。

    提了蒲公英的工单,没有结论,让自己查。

    百度参考结论很少,只有一篇文章说用 cygwin 下的 curl 上传正常,验证了确实正常,平台不乱码,curl 的 response 也正常。

    而使用新版本的 Windows 版 curl,或 cygwin/bin/下的 curl 都是乱码。

    各位有人遇到过吗?

    6 replies    2020-04-03 17:50:08 +08:00
    ysc3839
        1
    ysc3839  
       Apr 3, 2020 via Android
    你的代码是怎样的呢?
    somehand
        2
    somehand  
    OP
       Apr 3, 2020
    @ysc3839 curl -F "file=@***" -F "_api_key=*****" -F "buildName=应用名称" -F "buildInstallType=2" -F "buildPassword=123456" -F "buildUpdateDescription=中文描述" https://www.pgyer.com/apiv2/app/upload
    andylsr
        3
    andylsr  
       Apr 3, 2020
    cmd 换个 utf-8 编码试试
    somehand
        4
    somehand  
    OP
       Apr 3, 2020
    @andylsr | iconv -f utf-8 -t gbk 结尾添加了 转 gbk 也是继续乱码。 是转错类型了?
    lvsemi1
        5
    lvsemi1  
       Apr 3, 2020
    windows 用自带的 iwr 不好么
    somehand
        6
    somehand  
    OP
       Apr 3, 2020
    @lvsemi1 需要能在 android studio gradle 中调用
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   950 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 21:49 · PVG 05:49 · LAX 14:49 · JFK 17:49
    ♥ Do have faith in what you're doing.