GeoIP Character Encoding

From: Date: Tue, 28 Jul 2009 22:10:33 +0000
Subject: GeoIP Character Encoding
Groups: php.general 
Request: Send a blank email to php-general+get-295985@lists.php.net to get a copy of this message
Hey, I'm using the PECL GeoIP module on php 5.2.10. When I look up an IP address, the geoip_record_by_name() function is giving me a string that contains "special" characters, such as the following: '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? Thank you for your time.

« previous php.general (#295985) next »