[OpenSCAD] How to detect chr(0)

Torsten Paul Torsten.Paul at gmx.de
Thu Apr 16 20:37:55 EDT 2015

The chr() function is supposed to return valid unicode characters in utf-8
encoding, so for example "echo(chr(128512));" is valid and should give the
smiley character U+1F600.

Invalid input values will return an empty string, chr(0) is always treated
as invalid.

Note: This means that asking for chr(255) will internally result in the
bytes 0xc3 0xbf and not 0xff. As len() is also utf-8 aware, len(chr(255))
still returns 1 as it's one character.


More information about the Discuss mailing list