在iOS 11中,键盘自动更正会创建无效的UTF8 [英] in iOS 11 the keyboard autocorrect creates invalid UTF8

查看:61
本文介绍了在iOS 11中,键盘自动更正会创建无效的UTF8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的应用程序接受用户文本输入,然后将其保存到服务器端数据库中.在iOS 11中,当您连续输入两个-"字符时,它们会自动组合成一个破折号(-).当您连续输入三个-"字符时,您将得到一个带无效终止符的符号+半符号.这给我的Rails Server造成了问题,因为它无效,所以无法解析此字符串.字符串如下所示:\ xE2 \ x80 \ x94 \ x00

Our app accepts user text input which we then save to a server-side database. In iOS 11 when you enter two "-" characters in a row they are automatically combined into an emdash (—). When you enter three "-" characters in a row you end up with an emdash + a half emdash which has an invalid terminator. This is causing issues for my rails server which cannot parse this string because it is invalid. The string looks like this: \xE2\x80\x94\x00

推荐答案

智能破折号"被称为过程是将两个/三个破折号转换为单个较大的破折号.仅在iOS 11中可用.可以使用 smartDashesType 进行控制.这是 UITextInputTraits 协议的一部分.

'Smart dashes' as it is called, is the process is converting two/three dashes to a single larger dash. This is only available from iOS 11. It can be controlled using smartDashesType which is a part of the UITextInputTraits protocol.

这篇关于在iOS 11中,键盘自动更正会创建无效的UTF8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆