|
You would expect numToChar to only accept byte values, and to always output a one-byte char value. In most cases, you'd be correct. What normally happens is that values greater than 255 are cropped, the same as "charNum mod 256".
However, on some platforms this does not happen. The confirmed affected platforms are Mac OSX and some Mac OS 9.2.2. It does not seem to affect Mac OS 9 in all cases, and may be related to language settings.
What this means is that any value greater than 255 or less than 0 will produce unexpected output. Generally, instead of returning a single character, two characters are returned. Presumably this is for future compatability with Unicode, but unfortunately it results in behaviour that is different on different operating systems.
Demo Movie
The above movie demonstrates whether your current system is byte-cropping the input for numToChar or not.
Download the .dir file
Article Information
Published: 2002.10.31
Author: Robert Tweed
|