AnsweredAssumed Answered

NULL characters in fields cause problems

Question asked by HOnzaKoudelka on Sep 18, 2012
Latest reply on Sep 18, 2012 by HOnzaKoudelka

Summary

NULL characters in fields cause problems

Product

FileMaker Pro

Version

12v2

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.

Examples:

* 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

Expected result

All calculations should work with the null character just like with any other character

Actual result

Some calculations cause problems, such as freezing, returning wrong results, etc.

Workaround

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:

StripNULLs(text) =
Case(IsEmpty(text); ""; Char(Code(Left(text; 1))) & StripNULLs(Middle(text; 2; Length(text) - 1)))

Outcomes