<div style="white-space:pre-wrap">I think this issue is bigger than that. As UAX #31 suggests, the most appropriate approach is canonicalizing identifiers by NFC, with specific treatment of ZWJ and ZWNJ by allowing them in three contexts, which will require thought as to how to implement.<br><br>Given that there is a specifically recommended algorithm on how to handle this issue, I&#39;m also not sure anymore that this requires a proposal; &quot;process Unicode correctly&quot; is really more of a bug fix because, given the strict limits of what&#39;s canonicalized, there shouldn&#39;t be a user-facing effect if we are merely proposing to prohibit glyphs from appearing in certain contexts where they are never in fact encountered in real language.<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 23, 2016 at 11:19 AM Sean Heber &lt;<a href="mailto:sean@fifthace.com">sean@fifthace.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I’m no unicode expert, but this sounds like the way to go to me.<br>
<br>
l8r<br>
Sean<br>
<br>
<br>
&gt; On Jun 23, 2016, at 11:17 AM, João Pinheiro via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;&gt; On 21 Jun 2016, at 20:15, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Jun 21, 2016 at 1:16 PM, Joe Groff &lt;<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a>&gt; wrote:<br>
&gt;&gt; Any discussion about this ought to start from UAX #31, the Unicode consortium&#39;s recommendations on identifiers in programming languages:<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://unicode.org/reports/tr31/" rel="noreferrer" target="_blank">http://unicode.org/reports/tr31/</a><br>
&gt;&gt;<br>
&gt;&gt; Section 2.3 specifically calls out the situations in which ZWJ and ZWNJ need to be allowed. The document also describes a stability policy for handling new Unicode versions, other confusability issues, and many of the other problems with adopting Unicode in a programming language&#39;s syntax.<br>
&gt;&gt;<br>
&gt;&gt; That&#39;s a fantastic document--a very edifying read. Given Swift&#39;s robust support for Unicode in its core libraries, it&#39;s kind of surprising to me that identifiers aren&#39;t canonicalized at compile time. >From a quick first read, faithful adoption of UAX #31 recommendations would address most if not all of the confusability and zero-width security issues raised in this conversation.<br>
&gt;<br>
&gt; From what I&#39;ve read of UAX #31 it does seem to address all of the invisible character issues raised in the discussion. Given their unicode status of of Default_Ignorable_Code_Points, I believe the best course of action would be to canonicalise identifiers by allowing invisible characters only where appropriate and ignoring them everywhere else.<br>
&gt;<br>
&gt; The alternative to ignoring them would be to not canonicalise identifiers and treat invisible characters as an error instead.<br>
&gt;<br>
&gt; This doesn&#39;t address the issue of unicode confusable characters, but solving that has additional problems of its own and would probably be better addressed in a different proposal entirely.<br>
&gt;<br>
&gt; I&#39;d like to start writing the proposal if there is agreement that this would be the best course of action.<br>
&gt;<br>
&gt; Sincerely,<br>
&gt; João Pinheiro<br>
&gt; _______________________________________________<br>
&gt; swift-evolution mailing list<br>
&gt; <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
</blockquote></div>