Tapping the dash key 3 times creates em-dash + null character, causing data loss in many apps

Number:rdar://34651564 Date Originated:26-Sep-2017 12:32 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:iOS 11
Classification:Crash/Hang/Data Loss Reproducible:Always
Smart Punctuation causes data loss when the dash key is tapped 3 times with the US English keyboard (other keyboards also likely). It enters a NULL character. This is unexpected and normally not easy to achieve as a user, but due to Smart Punctuation it’s very easy. Much logic breaks and stops string counting after a \0.

Steps to Reproduce:
Enter text e.g. in https://pdfviewer.io/ via a free text annotation. Tripe-tap the - key to create em-dash + null character. Continue tapping. 
Restart app
Load document, edit, observe all text is missing after the null-character

Expected Results:
iOS should not ever under any circumstance insert \0 characters in text fields.

Actual Results:
Inserting \0 into text

iOS 11

Originally stumbled over this issue in https://twitter.com/gabrielhauber/status/912590194099888128.

This also breaks any app using Core Data. No sample needed as it can be trivially tested with basically any app. Also affects Apple Notes. (https://twitter.com/teek_eh/status/912624127768371202)


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!