[OpenSCAD] How to detect chr(0)

doug moen doug at moens.org
Fri Apr 17 22:12:22 EDT 2015


> Also, NULL can be represented as "\u0000"

echo("\u0000" == "\u0020");
ECHO: true

So \u0000 is converted to a space character.

>@Torsten, according to Wikipedia, 0x00 is NULL and is a valid code point.
>???

There are a couple of good reasons to not support NUL.
They all stem from the fact that C programs use the NUL character to
terminate a character string.

   - One reason might be implementation reasons: a lot of the string APIs
   available to C++ programs use NUL terminated strings.
   - Another reason is security related: there are a number of network
   security exploits that are involve the insertion of NUL characters into
   network traffic. There are a couple of projects that build web interfaces
   on top of OpenSCAD, so if a malicious OpenSCAD script has the ability to
   insert NUL characters into these project's web traffic, it might be
   possible to build an exploit.


On 17 April 2015 at 18:12, MichaelAtOz <oz.at.michael at gmail.com> wrote:

> Also, NULL can be represented as "\u0000"
>
> t=chr(0);
> u="\u0000";
> u2="\u0000";
> echo(t,u); //ECHO: ""," "
> if (t==u)
>   echo("t==u"); // no
> if (u==u2)
>   echo("u==u2"); // yes
> text(u);  // blank
>
> You should read the 'invalid characters' part in the Wikipedia article.
> There a a number of Unicode chars in the range 0x7F-0xFF that are invalid.
> It is just luck that they seem to work.
>
>
>
> -----
> Unless specifically shown otherwise above, my contribution is in the
> Public Domain; To the extent possible under law, I have waived all
> copyright and related or neighbouring rights to this work. This work is
> published globally via the internet. :) Inclusion of works of previous
> authors is not included in the above.
>
> The TPP is no simple “trade agreement.”   Fight it!
> http://www.ourfairdeal.org/
> --
> View this message in context:
> http://forum.openscad.org/How-to-detect-chr-0-tp12351p12411.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20150417/6d5c3d8d/attachment-0002.html>


More information about the Discuss mailing list