Fix language/country detection for Safari

This fixes the language/country detection for Safari browsers by requiring a space before the language code and by allowing the country code to include capital letters. This fixes the HP TouchPad detection reported in #36.