views:

44

answers:

1

Hi,

i used the functions pg_escape_bytea() and pg_escape_string() but i had to find out that there are several problems with umlautes:

if i do pg_escape_bytea("pöl") , where "pöl" is utf8 i get "p\\303\\266l", and i cannot compare this with my values in the tabels ... so what can i do?

have somebody written a function so far, which escapes my string correctly with umlauts?

thx

A: 

Why don't you use pg_escape_string() or pg_query_params() to escape a string as a string? The value "pöl" doesn't look like binary data, it looks like a string.

Frank Heikens
okay thats right, but i also escap JSON with it, and there are several problems with slashes then...
helle
JSON is still a string, so you still need a string-function to escape. Both pg_escape_string and pg_query_params will do fine, just start testing.
Frank Heikens
you are right! after trying severl differnt ways i had somwhere something in the code which destroyed the handling. wrote the concering parts new, and works like a charm :-) thanks
helle