Encoding issues

Hi all,

I have got a problem with the encoding of special caracters.
My DB uses the Encoding 'LATIN1'.
I modify data like this in psql:

SET CLIENT_ENCODING =3D 'LATIN1';
update auftraggeber set name_de=3D'Europäische Union';

When I access this in PHP (using this Query:
SET CLIENT_ENCODING =3D 'LATIN1';
select name_de from projekte.sel_auftraggeber;

I get this:

Europ=C3=A4ische Union

Hhhm.

Is there something I miss here?
Is there a way to specify a "standard" encoding in PHP,
so that I don't have to set the encoding?

Thanks for your help,
cheers, Dani


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo [at] postgresql.org
Dani Oderbolz [ Mo, 28 April 2003 13:14 ] [ ID #31427 ]

Re: Encoding issues

=D0=92 =D0=9F=D0=BD=D0=B4, 28.04.2003, =D0=B2 13:14, Dani Oderbolz =D0=BF=
=D0=B8=D1=88=D0=B5=D1=82:
> Hi all,
>
> I have got a problem with the encoding of special caracters.
> My DB uses the Encoding 'LATIN1'.
> I modify data like this in psql:
>
> SET CLIENT_ENCODING =3D 'LATIN1';
> update auftraggeber set name_de=3D'Europ=C3=A4ische Union';

Where specificially does the string "Europ=C3=A4ische Union" come from? Is =
it
input in a web form?

>
> When I access this in PHP (using this Query:
> SET CLIENT_ENCODING =3D 'LATIN1';
> select name_de from projekte.sel_auftraggeber;
>
> I get this:
>
> Europ=C3=83=C2=A4ische Union

This looks like UTF-8.

--
Markus Bertheau.
Berlin, Berlin.
Germany.


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo [at] postgresql.org
Markus Bertheau [ Mi, 30 April 2003 09:51 ] [ ID #31432 ]

Re: Encoding issues

Markus Bertheau wrote:

>=D0=92 =D0=9F=D0=BD=D0=B4, 28.04.2003, =D0=B2 13:14, Dani Oderbolz =D0=BF=
=D0=B8=D1=88=D0=B5=D1=82:
>
>
>>Hi all,
>>
>>I have got a problem with the encoding of special caracters.
>>My DB uses the Encoding 'LATIN1'.
>>I modify data like this in psql:
>>
>>SET CLIENT_ENCODING =3D 'LATIN1';
>>update auftraggeber set name_de=3D'Europ=C3=A4ische Union';
>>
>>
>
>Where specificially does the string "Europ=C3=A4ische Union" come from? Is=
it
>input in a web form?
>
>
>
>>When I access this in PHP (using this Query:
>>SET CLIENT_ENCODING =3D 'LATIN1';
>>select name_de from projekte.sel_auftraggeber;
>>
>>I get this:
>>
>>Europ=C3=83=C2=A4ische Union
>>
>>
>
>This looks like UTF-8.
>
>
>

try that one ...
we have used this as a basic workaround for some problems we had with
encoding ...

-- converts any character set to any character set ...
CREATE OR REPLACE FUNCTION iconv(text, text, text) RETURNS text AS '
use Text::Iconv;

my $from =3D shift;
my $to =3D shift;
my $code =3D shift;

$converter =3D Text::Iconv->new($from, $to);
$converted =3D $converter->convert($code);

return $converted;

' LANGUAGE 'plperlu';

-- SELECT iconv('LATIN2', 'IBM437', 'Hallo =C3=9C=C3=BC a');
-- SELECT pg_client_encoding(), iconv(pg_client_encoding(), 'IBM437',
'Hallo =C3=9C=C3=BC a');
SELECT iconv(pg_client_encoding(), 'IBM437', 'Hallo =C3=9C=C3=BC a');


maybe this is useful ...

Hans


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo [at] postgresql.org so that your
message can get through to the mailing list cleanly
Hans-Juergen Schoenig [ Mi, 30 April 2003 10:04 ] [ ID #31433 ]
Datenbanken » gmane.comp.db.postgresql.php » Encoding issues

Vorheriges Thema: Strange problem with session and header("Location:script.php?".SID)
Nächstes Thema: New New :(( - Trying to figure out a couple things - Please help