false alarm. the error was in my mysql abstraction class. some time ago i put a function in there to clean up invalid utf8 strings and it was doing a nice job on my binary strings. On 6/17/09 1:24 PM, "Tom Worster" <fsb@xxxxxxxxxx> wrote: > i'm having trouble getting binary data into blobs in mysql. > > to help debug, i set up a test db and discovered that when i insert a binary > string encoded using mysql_real_escape_string (according to the php manual: > "If binary data is to be inserted, this function must be used."), only byte > values lower than 128 are accepted. all bytes in the string with value greater > equal 128 are stripped out upon insertion, regardless where they appear in the > string. > > > so, for example if i create a test binart string thus: > > $data = ''; > for ( $n=0; $n<=127; $n++ ) > $data .= chr($n) . chr($n+128); > > and inset it (using mysql_real_escape_string), the blob value that appears as > viewed with phpmyadmin is only 128 bytes long. and when i select it, the value > i get back is the same as if i had inserted: > > $data = ''; > for ( $n=0; $n<=127; $n++ ) > $data .= chr($n); > > any idea why? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php