NULL characters in fields cause problems
Operating system version
Mac OS X 10.6.8
Description of the issue
It is possible to paste text containing a null character to a field from clipboard.
Such character then causes troubles because some functions do not expect strings to contain such characters.
* the Code functions correctly returns 0 for such character
* Char(0) returns an empty string
* Evaluate(Quote(*text*)) freezes filemaker then *text* contains a null character
Example demonstrating the bug is available at http://24usw.com/nullbug
Steps to reproduce the problem
1. Copy text containing a null character to clipboard (you can use TextWrangler for this)
2. Paste the text into a field
3. Try to use the text in calculations
All calculations should work with the null character just like with any other character
Some calculations cause problems, such as freezing, returning wrong results, etc.
The only workaround I have been able to find is to use this custom function as auto-enter (or as custom menu item replacement for Paste) to correct the value when being pasted:
Case(IsEmpty(text); ""; Char(Code(Left(text; 1))) & StripNULLs(Middle(text; 2; Length(text) - 1)))