tags:

views:

146

answers:

1

Hello, I want like to enhance spam protection on my site. I've found out that after being banned by ip bots don't change the Accept-Language and Accept-Charset http headers (so most of spam comes with windows-1251 accept-charset). I understand that there may be normal users with unordinary preferences, but anyways, how can I determine which charset and language headers are most popular in a particular country? TIA

+1  A: 

This answer has two parts: determining where your user comes from, and what language they speak. To determine where they come from, you can use a service such as hostip.info, which has an API which takes an IP address and returns a country code. Second, you would need a list such as this one to translate the country code into a language code. You could use either a full database or a simple dict to store the mapping.

bluejeansummer