Search Postgresql Archives

Re: Postgres, apps, special characters and UTF-8 encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux