Re: [PHP] Escaping escaped chars

2002-06-20 Thread Gerard Samuel

One of the guys over on the php-db list told me that to store the binary 
string correctly in postrgresql, that I would
have to double quote whats already there.
So in essence, by the time it hits the database, it has to be ->
\\\0PZ\\\0<Îê˜Úµ

Any suggestions to modify the string like this...
Maybe I should be looking into one of the preg functions

Thank You.

Michael Sweeney wrote:

>Just escape the \ with a single escape character. eg. your string
>'\0PZ\0<Îê˜Úµ' would end up as '\\0PZ\\0<Îê˜Úµ' - each \ simply
>escapes the backslash following it. If you add two backslashes, you end
>up with one too many which is what the error is referring to.
>
>
>..micahel..
>
>On Thu, 2002-06-20 at 10:59, Gerard Samuel wrote:
>  
>
>>Im trying to move some binary strings from mysql to postgresql,
>>and the binary strings has escape chars '\' in them.
>>I was told to double escape them like so -> '\\\'
>>Here is what Im trying ->
>>
>>$data = '\0PZ\0<Îê˜Úµ';  // This is a representation from an mysql dump
>>$data2 = str_replace('/\', '/\/\/\', $data);
>>
>>Im getting ->
>>Unexpected character in input: '\' (ASCII=92) state=1
>>I guess my str_replace() isn't correct.
>>
>>Am I going about the right way to double escape them.
>>Thanks.
>>
>>
>
>
>
>
>  
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Escaping escaped chars

2002-06-20 Thread Michael Sweeney

Just escape the \ with a single escape character. eg. your string
'\0PZ\0<Îê˜Úµ' would end up as '\\0PZ\\0<Îê˜Úµ' - each \ simply
escapes the backslash following it. If you add two backslashes, you end
up with one too many which is what the error is referring to.


..micahel..

On Thu, 2002-06-20 at 10:59, Gerard Samuel wrote:
> Im trying to move some binary strings from mysql to postgresql,
> and the binary strings has escape chars '\' in them.
> I was told to double escape them like so -> '\\\'
> Here is what Im trying ->
> 
> $data = '\0PZ\0<Îê˜Úµ';  // This is a representation from an mysql dump
> $data2 = str_replace('/\', '/\/\/\', $data);
> 
> Im getting ->
> Unexpected character in input: '\' (ASCII=92) state=1
> I guess my str_replace() isn't correct.
> 
> Am I going about the right way to double escape them.
> Thanks.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Escaping escaped chars

2002-06-20 Thread Gerard Samuel

Im trying to move some binary strings from mysql to postgresql,
and the binary strings has escape chars '\' in them.
I was told to double escape them like so -> '\\\'
Here is what Im trying ->

$data = '\0PZ\0<Îê˜Úµ';  // This is a representation from an mysql dump
$data2 = str_replace('/\', '/\/\/\', $data);

Im getting ->
Unexpected character in input: '\' (ASCII=92) state=1
I guess my str_replace() isn't correct.

Am I going about the right way to double escape them.
Thanks.

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php