in iOS 11 the keyboard autocorrect creates invalid UTF8

我是研究僧i 提交于 2021-02-08 11:15:42

问题


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


回答1:


'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.



来源:https://stackoverflow.com/questions/47022956/in-ios-11-the-keyboard-autocorrect-creates-invalid-utf8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!