Re: Insert asc(0) characters in strings



Mikael Lenfors schreef:

I'm replacing ' characters with two ', this seems to work.

The SysUtils function "QuotedStr" is available to handle this.

The problem seems to be all characters with ascii value 0. How can I insert them?

You are inserting binary data into a char type field, asking for problems.

You could instead:

- "escape" each $00 character by replacing it with something else (at the cost of some extra processing). You can use any string that can not occur as a substring in you actual data, for instance '#$00' or '0x00' or '&Null;' or whatever.

- convert all your char data to base64 (at the cost of some extra processing and space) so you end up with true char data

- use a database blob field type instead of a char field type

Danny
---
.