duanpin2009 2013-03-29 14:39
浏览 300
已采纳

Android PHP Base64解码具有不同的结果

I have a big problem : I don't have the same result if I do base64_decode($string); in php or if I do Base64.decode(string); in android.

Example : with this string : WWhiZWWSZpNlaGSTnpljZQ==

In php, result is Yhbee’f“ehd“ž™ce .

In android, the result is Yhbee�f�ehd���ce

I think there is an encoding problem, but I don't know where, the output of my PHP server is ISO-8859-1, I don't find how to tell to Base64.decode to use this type of encoding.

Can you help me please. Thx for answers.

PS : I can't touch the PHP script.

  • 写回答

2条回答 默认 最新

  • drlma06060 2013-03-29 14:52
    关注

    You should try this:

     Base64.decode(content.getBytes("ISO-8859-1"), Base64.DEFAULT);
    

    By this You convert the input String content to ISO-8859-1 encoded byte stream that will be decoded from base64.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64