Re: [GENERAL] Postgres, apps, special characters and UTF-8 encoding - Mailing list pgsql-general

From vinny
Subject Re: [GENERAL] Postgres, apps, special characters and UTF-8 encoding
Date
Msg-id 66b4ff1fb73dfff6c0143ca239fe60b7@xs4all.nl
Whole thread Raw
In response to [GENERAL] Postgres, apps, special characters and UTF-8 encoding  (Ken Tanzer <ken.tanzer@gmail.com>)
List pgsql-general
On 2017-03-08 00:20, Ken Tanzer wrote:
> Hi.  I've got a recurring problem with character encoding for a
> Postgres-based web PHP app, and am hoping someone can clue me in or at
> least point me in the right direction.  I'll confess upfront my
> understanding of encoding issues is extremely limited.  Here goes.
>

>   And that one way or another, the encoding
> needs to be translated before it can be placed into the database.

> Ken
>
> --
>

You don't really have to translate the encoding, because all parts of
the system
are capable of dealing with all encodings.

What you have to make sure that that they are indeed all working in the
same encoding.
You have to set the encoding of the HTML document, the database, and the
database connection
to the same encoding, like utf8. People tend to forget the "set names"
on the database connection,
which can make the database think you are sending latin1, but you are
really sending utf-8, and presto problemo.

Then the only problem left is that PHP doesn't do utf-8 very well
internally
  so if you receive data from an UTF-8 page and want to substring etc
then you have to use the multibyte variants
of those functions. You could convert everything back to latin1 first,
but then
you might as well just do everything in latin1 in the first place.


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: [GENERAL] Request to confirm which command is use for exclusive operation
Next
From: Yogesh Sharma
Date:
Subject: Re: [GENERAL] Request to confirm which command is use for exclusive operation