emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode confusables and reordering characters considered harmful, a


From: Eli Zaretskii
Subject: Re: Unicode confusables and reordering characters considered harmful, a simple solution
Date: Thu, 04 Nov 2021 18:50:04 +0200

> Date: Thu, 04 Nov 2021 14:10:01 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: cpitclaudel@gmail.com, stefan@marxist.se, emacs-devel@gnu.org, 
>     db48x@db48x.net, monnier@iro.umontreal.ca, yuri.v.khan@gmail.com
> 
> >> The answer is above: "given that these controls can have a dangerous 
> >> effect".
> >
> > But they don't.  Not more than just using RTL characters within LTR text 
> > would.  Just revisit the example posted by Stefan (which I slightly 
> > modified to be more realistic):
> >
> >      myfun("שָׁלוֹם" ,"السّلامعليكم");
> >
> > Which string does this function call pass as the first argument, and 
> > which as the second one?
> 
> There is no danger in that example, and in particular nothing invisible. 

Ha-ha, very funny.

> The programmer must just be aware that compilers read source code files in 
> byte order, which might be different from the order in which the string is 
> displayed on screen, but is identical to the order in which one 
> forward-char's through the string.

If we are going to assume users forward-char through every piece of
code they look at, then the examples we were discussing present no
problem, either.

> There is a danger when, because the source code contains invisible control 
> characters, the programmer sees something on their screen, and the 
> compiler sees something completely different.

That's exactly what happens in the above example.  Except that
reordering happens automatically without any invisible characters,
i.e. also "invisibly".



reply via email to

[Prev in Thread] Current Thread [Next in Thread]