An unexpected side effect of Apple's new Smart Punctuation feature in iOS 11 has manifested and is causing some problems with apps that use Core Data to store strings. Here's how to turn off Smart Punctuation, and why you might want to for now.
First spotted by SongSheet app developer Gabriel Hauber, Smart Punctuation is periodically inserting a null byte. Specifically, if the user enters two dashes, it generates an en-dash. If the user enters three, then the en-dash is displayed, but a null-byte is appended after the en-dash.
The null byte insertion prematurely ends a string, which as a best case causes a truncation of data — but can also lead to instability and crashing.
In all likelihood, Apple is already working on a fix, and given a brief perusal of developer documentations, it appears to be able to be temporarily disabled by app developers. However, to fix the problem on your personal devices and sidestep the issue for now in its entirety, here's how to turn off the feature.
In Settings, tap General. Then, tap Keyboards, and toggle Smart Punctuation to off.
8 Comments
I understand the problems this may cause some people until it is resolved, but really like the ability to easily add an en-dash while typing.
I would love to see more details about what's really going on here. In iOS, user input comes in the form of an NSString object (or a String object in Swift). These string objects are fully UNICODE enabled, include length counters, and do not use NULL bytes as terminators.
If an application is grabbing the raw data and treating it as a C-style string, whether for internal use or for use with an external framework, then problems like this are likely to occur, because the byte-stream can include zero values.
On the other hand, if the application is doing the right thing, and calling appropriate member functions to get (for example) a UTF-8 representation of the UNICODE string, then there shouldn't be any zeros in the resulting byte stream. If there are, then Apple's got a bug somewhere, which will clearly need to be fixed.
The problem with workarounds like this - asking folks to disable the setting for now - is that people often don't remember to go back and re-enable it after Apple quietly fixes the issue in the next update. Heck, they likely won't know that Apple fixed it - since Apple doesn't detail every fix that goes into an update.
So, the error seems to be on Apple's side. I guess that the third tap should turn the en-dash into an em-dash. Is that correct? Also, your image caption, should state "hyphens, en-, and em-dashes, example from fonts.com"
I just wanted to say, as an erstwhile C programmer, C-style strings (null terminated character arrays) need to DIAF. They have been the source of so many bugs over the decades. I’d bet money that’s what SongSheet is experiencing.