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条)

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码