dongsui8162 2014-11-24 11:40
浏览 32

检测URL参数中的错误字符

I've been getting logs in my error log, which I've tracked down to be a problem with bad characters being send as URL parameters. My problem is that i don't know how to detect those in my code to be able to return a proper error message.

This is the parameter that is making a mess:

%E2%80%A2%C2%B0$%CallmeG.G%25$%C2%B0%E2%80%A2&name%5B35%5D

After urldecoding, this will be:

•°$�llmeG.G%$°•

I can see that something goes wrong here with the "�". Which is the only character messing up my code. However I am not sure how to detect this or help the problem.

  • 写回答

1条回答 默认 最新

  • douzhi7451 2014-11-24 12:14
    关注

    If you

    urldecode('%Ca');
    

    the output is

    You need to remove (or escape) the '%' preceding 'Ca'.

    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题