country-codes

How to get Country (or its ISO code)?

与世无争的帅哥 提交于 2019-11-26 22:39:32
问题 What is the best way to get country code? As of now I know two ways one is to get by TelephonyManager and another by Locale which is the other best & unique way to find country code in android. 回答1: Try this, TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); String countryCode = tm.getSimCountryIso(); 回答2: There are always huge discussions about this, and I never understand why developers and companies go for the complex way. The language selected by the

Is there an open source java enum of ISO 3166-1 country codes

你。 提交于 2019-11-26 22:34:22
问题 Does anyone know of a freely available java 1.5 package that provides a list of ISO 3166-1 country codes as a enum or EnumMap? Specifically I need the "ISO 3166-1-alpha-2 code elements", i.e. the 2 character country code like "us", "uk", "de", etc. Creating one is simple enough (although tedious), but if there's a standard one already out there in apache land or the like it would save a little time. 回答1: Now an implementation of country code (ISO 3166-1 alpha-2/alpha-3/numeric) list as Java

Get visitors language & country code with javascript (client-side) [duplicate]

a 夏天 提交于 2019-11-26 14:32:30
This question already has an answer here: Best way to determine user's locale within browser 7 answers Question: Is there a javascript (client-side) code to get visitors country/language code, that is accurate and is cross-"modern"-browser ? I am looking for results like 'en-US' , 'sv-SE' , 'nl-NL' , etc. Related questions to this have been asked before (some SO links: 1 , 2 , 3 , 4 , among others) but I didn't find answer and some of the answers are some yearls old and in some cases referring to even more old articles, which makes me think there are new solutions for this. I tried : var

List of phone number country codes

旧巷老猫 提交于 2019-11-26 08:04:54
问题 On this Wikipedia entry I found out that ITU Telecommunication Standardization Sector (ITU-T) is providing such list of country calling codes. Here is a pdf: http://www.itu.int/dms_pub/itu-t/opb/sp/T-SP-E.164D-2009-PDF-E.pdf I wonder where to find this in a xml file or similar? I need to do find out which country a phone number is from, both in javascript and c#. 回答1: There is an Excel file with regexps here. You can easily "convert" it to XML and you will be able to determine country by the

Get visitors language & country code with javascript (client-side) [duplicate]

夙愿已清 提交于 2019-11-26 04:22:39
问题 This question already has answers here : Best way to determine user's locale within browser (8 answers) Closed last year . Question: Is there a javascript (client-side) code to get visitors country/language code, that is accurate and is cross-\"modern\"-browser ? I am looking for results like \'en-US\' , \'sv-SE\' , \'nl-NL\' , etc. Related questions to this have been asked before (some SO links: 1,2,3,4, among others) but I didn\'t find answer and some of the answers are some yearls old and

Getting visitors country from their IP

余生长醉 提交于 2019-11-26 00:34:47
问题 I want to get visitors country via their IP... Right now I\'m using this (http://api.hostip.info/country.php?ip=...... ) Here is my code: <?php if (isset($_SERVER[\'HTTP_CLIENT_IP\'])) { $real_ip_adress = $_SERVER[\'HTTP_CLIENT_IP\']; } if (isset($_SERVER[\'HTTP_X_FORWARDED_FOR\'])) { $real_ip_adress = $_SERVER[\'HTTP_X_FORWARDED_FOR\']; } else { $real_ip_adress = $_SERVER[\'REMOTE_ADDR\']; } $cip = $real_ip_adress; $iptolocation = \'http://api.hostip.info/country.php?ip=\' . $cip;