[PHP] Re: GeoIP Character Encoding
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: GeoIP Character Encoding
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=2031highlight= 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
Re: [PHP] Re: GeoIP?
Michelle Konzack wrote: Hello Per, Am 2009-03-15 15:12:47, schrieb Per Jessen: The easiest is to use a DNS service - this is the best one I know: http://countries.nerd.dk/ This is cool... I'm glad you like it - it really is cool. /Per -- Per Jessen, Zürich (4.1°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: GeoIP?
Thanks for this! -- Louie Miranda (lmira...@gmail.com) http://www.louiemiranda.net Quality Web Hosting - www.axishift.com Pinoy Web Hosting, Web Hosting Philippines On Mon, Mar 16, 2009 at 3:48 PM, Per Jessen p...@computer.org wrote: Michelle Konzack wrote: Hello Per, Am 2009-03-15 15:12:47, schrieb Per Jessen: The easiest is to use a DNS service - this is the best one I know: http://countries.nerd.dk/ This is cool... I'm glad you like it - it really is cool. /Per -- Per Jessen, Zürich (4.1°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: GeoIP?
Nitsan Bin-Nun escreveu: Hi Michelle, Try to use sqlite instead of any other database. It will be better I guess. Regards, Nitsan On Sun, Mar 15, 2009 at 9:08 PM, zerof . wrote: Please, avoid to reply our messages with entire heads. I don't like to see my email along these. zerof -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: GeoIP?
On Mon, Mar 16, 2009 at 12:01, zerof ze...@terra.com.br wrote: Please, avoid to reply our messages with entire heads. I don't like to see my email along these. Then unsubscribe. Before subscribing and posting to any mailing list, you should read the rules and regulations of the list. Had you done so here, you'd have seen: Be sure to click Reply-All to reply to list. Clicking Reply will email the author of the message privately. It's one of the guidelines on http://php.net/mailinglists, and it's been the practice of this mailing list for years. There is no desire or plan to change this. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: GeoIP?
Forgotten one thing: Am 2009-03-15 13:52:52, schrieb Michelle Konzack: Hello, I am in creation of a WaveLAN service in Germany and my HTML-Form is DoS'ed be idiots outside of Germany. Can someone tell me how to prevent peoples, filling out the form without being in Germany? Note: I do not want to load the whole GeoIP Database in my scripts. Or is there a Free Online-Service which can do this? If not, it would be a nice project to start and could work like the RBL. END OF REPLIED MESSAGE Yes, I KNOW http://search.cpan.org/~borisz/Geo-IP-1.37/lib/Geo/IP.pm and I have tried to implement it in PHP, but it is very slow... Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ Michelle Konzack http://www.can4linux.org/ Apt. 917 http://www.flexray4linux.org/ 50, rue de Soultz Jabber linux4miche...@jabber.ccc.de 67100 Strasbourg/France IRC #Debian (irc.icq.com) Tel. DE: +49 177 9351947 ICQ #328449886Tel. FR: +33 6 61925193 signature.pgp Description: Digital signature
[PHP] Re: GeoIP?
Hello Nitsan, Am 2009-03-15 15:39:26, schrieb Nitsan Bin-Nun: Take a look at this: http://www.maxmind.com/app/geolitecountry Use indexes, I think the checkup won't take long. I have it installed (php5-geoip, 1.0.3-1) , but it is realy slow OK, now I have greped for DE and the database is now only 9607 lines insteed of 108166 and it is a little bit faster... However, it has a heavy Disk-IO and I do not know, if my Hoster like such stuff. :-/ Maybe PostgreSQL or MySQL would be better? Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ Michelle Konzack http://www.can4linux.org/ Apt. 917 http://www.flexray4linux.org/ 50, rue de Soultz Jabber linux4miche...@jabber.ccc.de 67100 Strasbourg/France IRC #Debian (irc.icq.com) Tel. DE: +49 177 9351947 ICQ #328449886Tel. FR: +33 6 61925193 signature.pgp Description: Digital signature
[PHP] Re: GeoIP?
Hello Per, Am 2009-03-15 15:12:47, schrieb Per Jessen: The easiest is to use a DNS service - this is the best one I know: http://countries.nerd.dk/ This is cool... OK, I have imported the ISO codes list and it just works how it should. Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ # Debian GNU/Linux Consultant # http://www.tamay-dogan.net/ Michelle Konzack http://www.can4linux.org/ Apt. 917 http://www.flexray4linux.org/ 50, rue de Soultz Jabber linux4miche...@jabber.ccc.de 67100 Strasbourg/France IRC #Debian (irc.icq.com) Tel. DE: +49 177 9351947 ICQ #328449886Tel. FR: +33 6 61925193 signature.pgp Description: Digital signature
[PHP] Re: GeoIP?
Michelle Konzack escreveu: Hello Nitsan, Am 2009-03-15 15:39:26, schrieb Nitsan Bin-Nun: Take a look at this: http://www.maxmind.com/app/geolitecountry Use indexes, I think the checkup won't take long. ... For a long time I'm using the geolitecountry without no problems. The procedures that I use, can be seen in the tutorial located at: http://www.educar.pro.br/i_en/GeoIP/ ( An alternative procedure to the one proposed, is to use phpMyAdmin to upload the CSV file to MySQL.) -- zerof http://www.educar.pro.br/ http://www.geoticks.com/ -- Você deve, sempre, consultar uma segunda opinião! -- Deixe todos saberem se esta informação foi-lhe útil. -- You must hear, always, one second opinion! In all cases. -- Let the people know if this info was useful for you! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: GeoIP?
Hi Michelle, Try to use sqlite instead of any other database. It will be better I guess. Regards, Nitsan On Sun, Mar 15, 2009 at 9:08 PM, zerof ze...@terra.com.br wrote: Michelle Konzack escreveu: Hello Nitsan, Am 2009-03-15 15:39:26, schrieb Nitsan Bin-Nun: Take a look at this: http://www.maxmind.com/app/geolitecountry Use indexes, I think the checkup won't take long. ... For a long time I'm using the geolitecountry without no problems. The procedures that I use, can be seen in the tutorial located at: http://www.educar.pro.br/i_en/GeoIP/ ( An alternative procedure to the one proposed, is to use phpMyAdmin to upload the CSV file to MySQL.) -- zerof http://www.educar.pro.br/ http://www.geoticks.com/ -- Você deve, sempre, consultar uma segunda opinião! -- Deixe todos saberem se esta informação foi-lhe útil. -- You must hear, always, one second opinion! In all cases. -- Let the people know if this info was useful for you! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php