Re: GeoIP Character Encoding
| From: | Nisse Engström | Date: | Wed, 29 Jul 2009 08:11:18 +0000 |
| Subject: | Re: GeoIP Character Encoding | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295995@lists.php.net to get a copy of this message | ||
On Tue, 28 Jul 2009 18:10:33 -0400, APseudoUtopia wrote:
> 'Portugal, 09, Vila Real De Santo António'
> 'Norway, 08, Ålesund'
> 'Portugal, 04, Vila Nova De Famalicão'
>
> (Note the ó, Å, and ã).
>
> I'm using PostgreSQL as my database. The database's encoding is UTF8,
> and the locale is C.
>
> When I try to insert the above strings into a VARCHAR column, I get
> errors similar to the following:
>
> ERROR: invalid byte sequence for encoding "UTF8": 0xf36e696f
> ERROR: invalid byte sequence for encoding "UTF8": 0xc56c
> ERROR: invalid byte sequence for encoding "UTF8": 0xe36f2c
>
> Now, I believe I can solve the problem by changing the client_encoding
> of my postgresql client (Right now, it is set to UTF8). However, I'm
> trying to figure out what encoding the GeoIP function is returning to
> me so that I can set the client_encoding appropriately. Is it LATIN1?
> How can I figure it out? And can I change it to UTF8?
The hex sequences are consistent with ISO-8859-1 (aka latin1).
You may want to check out mbstring, iconv or recode:
<http://se.php.net/manual/en/refs.international.php>
/Nisse