Xcode: non-printing characters are hard to deal with

Originator:igeek1
Number:rdar://47482143 Date Originated:23-Jan-2019 11:54 AM
Status:Duplicate of 34872897 Resolved:24-Jan-2019 02:50 PM
Product:Developer Tools Product Version:Xcode 10.1 (10B61) on macOS 10.14.2 (18C54)
Classification:UI/Usability Reproducible:Always
 
Summary:
Non-printing characters, especially in strings, are hard to notice, and can cause subtle bugs. Xcode should either show an error/warning in such cases, or should render these characters in a special way that makes it more obvious that they are present.

Steps to Reproduce:
1. Try to run this code:

let url = URL(string: "https://apple.com") // valid URL
let sadness = URL(string: "‌https://apple.com") // zero-width joiner at start of string, invalid URL

Expected Results:
It’s trivially easy to tell that the first string has all printing characters, and the second has a U+200D ZERO WIDTH NON-JOINER at the start. Xcode either shows a warning/error or renders the character as some kind of special glyph, maybe one that you can click on to get more info.

Actual Results:
Xcode does nothing to help you see what’s going on. Your only chance of noticing is either a) enumerating the string character-by-character, or b) using the arrow keys to move one character at a time.

Version:
Xcode 10.1 (10B61) on macOS 10.14.2 (18C54)

Notes:
Useful site for seeing non-printing characters in a string: https://www.soscisurvey.de/tools/view-chars.php.

Comments


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!