Re: GeoIP Character Encoding

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

 



On Tue, 28 Jul 2009 18:10:33 -0400, APseudoUtopia wrote:

> 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:

The PECL GeoIP page links to <http://www.maxmind.com/>, and a
search for "charset" reveals the following:


<http://forum.maxmind.com/viewtopic.php?p=2031&highlight=>

<quote>

    the binary database return the cityname in iso-8859-1 by default.
    I guess your output is in a different charset. 

    The CAPI based wrappers have a set_charset method. 

    If you use any other API, use the language charset encoding to
    transform iso-8859-1 into the desired output format. 

    for php you might use: 

       Code:
       $city = mb_convert_encoding( $old_city, 'UTF-8', 'ISO-8859-1');

    or 

       Code:
       $city =  utf8_encode ( $oold_city )

</quote>


/Nisse

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux