characterfilemakernul

Is there any way to prevent or detect char(0) from texts?


In some occasions, specially when copy-pasting, we end up having some text fields with a character 0 (nul) at the end of a string.

It doesn't show in any way when you display the data, but you do detect it when you export it.

Exported text with null char

We've tried to (at least) detect it by using the "Position" function.

However Position(text_field, char(0), 1, 1) won't find this char (it does return 0, even if the character is there).

I guess this is some kind of bug from FileMaker, but I'd like to know if anyone has found a way to circumvent it...

More info and a database sample at: https://community.claris.com/en/s/question/0D53w00005wrUMMCA2/character-0-0x0-in-text-fields


Solution

  • Unfortunately, the result of Char(0) is an empty string, not the expected control character.

    You can generate the null character in a number of ways:

    or paste it into a global field and get it from there.

    Once you have the character, it's easy to detect it or just substitute it out.


    You may want to bypass the entire issue by allowing only printable characters - see, for example: https://www.briandunning.com/cf/1291