pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Encoding issues
3+ messages / 3 participants
[nested] [flat]

* Encoding issues
@ 2003-04-28 11:14  Dani Oderbolz <oderbolz@ecologic.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Dani Oderbolz @ 2003-04-28 11:14 UTC (permalink / raw)
  To: pgsql-php

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 = 'LATIN1';
update auftraggeber set name_de='Europäische Union';

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

I get this:

Europäische 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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Encoding issues
@ 2003-04-30 07:51  Markus Bertheau <twanger@bluetwanger.de>
  parent: Dani Oderbolz <oderbolz@ecologic.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Markus Bertheau @ 2003-04-30 07:51 UTC (permalink / raw)
  To: Dani Oderbolz <oderbolz@ecologic.de>; +Cc: pgsql-php

В Пнд, 28.04.2003, в 13:14, Dani Oderbolz пишет:
> 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 = 'LATIN1';
> update auftraggeber set name_de='Europäische Union';

Where specificially does the string "Europäische Union" come from? Is it
input in a web form?

> 
> When I access this in PHP (using this Query:
> SET CLIENT_ENCODING = 'LATIN1';
> select name_de from projekte.sel_auftraggeber;
> 
> I get this:
> 
> Europäische Union

This looks like UTF-8.

-- 
Markus Bertheau.
Berlin, Berlin.
Germany.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Encoding issues
@ 2003-04-30 08:04  Hans-Juergen Schoenig <postgres@cybertec.at>
  parent: Markus Bertheau <twanger@bluetwanger.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Hans-Juergen Schoenig @ 2003-04-30 08:04 UTC (permalink / raw)
  To: Markus Bertheau <twanger@bluetwanger.de>; pgsql-php

Markus Bertheau wrote:

>В Пнд, 28.04.2003, в 13:14, Dani Oderbolz пишет:
>  
>
>>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 = 'LATIN1';
>>update auftraggeber set name_de='Europäische Union';
>>    
>>
>
>Where specificially does the string "Europäische Union" come from? Is it
>input in a web form?
>
>  
>
>>When I access this in PHP (using this Query:
>>SET CLIENT_ENCODING = 'LATIN1';
>>select name_de from projekte.sel_auftraggeber;
>>
>>I get this:
>>
>>Europäische 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 = shift;
my $to = shift;
my $code = shift;

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

return $converted;

' LANGUAGE 'plperlu';

-- SELECT iconv('LATIN2', 'IBM437', 'Hallo Üü a');
-- SELECT pg_client_encoding(), iconv(pg_client_encoding(), 'IBM437', 
'Hallo Üü a');
SELECT iconv(pg_client_encoding(), 'IBM437', 'Hallo Üü a');


maybe this is useful ...

    Hans




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2003-04-30 08:04 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-04-28 11:14 Encoding issues Dani Oderbolz <oderbolz@ecologic.de>
2003-04-30 07:51 ` Markus Bertheau <twanger@bluetwanger.de>
2003-04-30 08:04   ` Hans-Juergen Schoenig <postgres@cybertec.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox