Re: Could not Store French Accent Marks Correctly in Postgres

From: "Jonathan Bond-Caron" <jbondc(at)openmv(dot)com>
To: "'Wang, Mary Y'" <mary(dot)y(dot)wang(at)boeing(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Could not Store French Accent Marks Correctly in Postgres
Date: 2010-08-21 15:13:21
Message-ID: 000c01cb4143$64e47860$2ead6920$@com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri Aug 20 05:10 PM, Wang, Mary Y wrote:
>
> So my questions are:
> (1) What is the best character encoding that would work for most of 
> those languages that have accent marks?

Store data in PostgreSQL as UTF-8

> (2) I assume that I also
> need to do some kind of conversion in the front end (PHP) as well.
>
> I'm running on Linux and Postgres 8.3.8.
>

If users are submitting the file names using an HTML form, use:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
...

If using some other method, the common encoding in Europe,north america is
CP1252, in php you can convert to UTF8 using:
mb_convert_encoding($str, 'UTF-8', 'Windows-1252');
http://www.php.net/manual/en/function.mb-convert-encoding.php

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Denis Papathanasiou 2010-08-21 16:23:51 Optimal indexing of Full Text Search (ts_vector & ts_query) columns?
Previous Message Ludwig Kniprath 2010-08-21 11:21:50 Re: Could not Store French Accent Marks Correctly in Postgres