dony39517 2016-11-15 14:51
浏览 100
已采纳

验证损坏的复制粘贴用户输入

I'm looking for a php function or library or suggestions that can validate broken form input value when customer copy & pastes broken utf8 string.

Scenario:

  1. Customer is asked to enter street name in
  2. He opens third party broken page where he is storing address
  3. Copies broken utf8 string (see examples)
  4. Paste this string in input field and clicks Submit

So on server side, I'm receiving "correct" valid utf8 value.

Is there a way to catch this some how so I could catch it and show error message?

Test examples:

  • "At’s ‘em"
  • "Bo�kowski"
  • 写回答

2条回答 默认 最新

  • doushou7169 2016-11-21 09:24
    关注

    Because there is no generic way of figuring out if value is wrong, I ended up matching regexp [A-Za-z0-9\ -.,] and showing warning message to user if not matched.

    (suggested by @soheyl)

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

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭