The Chinese Area Code & Zip Code

本文提供了中国主要城市的区号及邮编信息,有助于国际电话拨打及海外网站注册时填写邮编的需求。包括北京、上海等城市的详细数据。
在国外网站注册时经常会要求输入zip code,以下就对中国的一些常用zip code列一下,这里转自一个英文网站.
The country code of China is 86. Each Chinese city has its own area code and different zip code. Below are the different ways for dialing Chinese numbers:

Dialing China from Abroad

  • To call China from abroad with a fixed telephone, dial the outbound number of your country + 86 (the country code of China) + area code of the Chinese city + fixed Chinese telephone number. To call a mobile phone number, dial the outbound number of your country + 86 + mobile phone number.
  • To call China from abroad with a cell phone, dial the outbound number of your country + 86 (the country code of China) + area code of the Chinese city + fixed Chinese telephone number. To call a mobile phone number, dial the outbound number of your country + 86 + mobile phone number.

Dialing within China

  • To call a fixed telephone number in a Chinese city from another Chinese city 0, then area code + fixed telephone number. To call a mobile phone number dial 0 + mobile phone number.
  • To call a fixed telephone number in a Chinese city from another Chinese city, dial 0 + area code + fixed telephone number. To call a mobile phone number, dial the mobile phone number directly without 0 prefix.

Note: Different countries require different outbound prefix numbers. For example, US and Canada: 011; Europe (including England): 00; Asia: some areas such as Saudi Arabia: 00; others (such as Seoul) are 001; Australia: 0011, Africa: 09…

 Major Chinese Cities :

City
Area Code
Zip Code
Beijing
10
100000
Chengdu
28
610000
Chongqing
23
404000
Dunhuang
937
736200
Guangzhou
20
510000
Guilin
773
541000
Guiyang
851
550000
Haikou
898
570100
Hangzhou
571
310000
Hohhot
471
010000
Huangshan
559
245000
Jinan
531
250200
City
Area Code
Zip Code
Kunming
871
650000
Lanzhou
931
730100
Lhasa
891
850100
Lijiang
888
674300
Luoyang
379
471900
Nanjing
25
210000
Qingdao
532
266600
Shanghai
21
200000
Shenzhen
755
518000
Suzhou
512
215400
Urumqi
991
830000
Xian
29
710000

 
### 中文字符编码与C/C++中的实现 当涉及到中文字符处理时,在 Windows 下开发 C/C++ 应用程序通常会遇到多字节字符集 (MBCS) 或宽字符的支持问题。为了确保能够正确读取和显示中文字符,建议设置项目配置以支持 GBK 编码[^1]。 对于具体的 `chinese_code.h` 头文件的设计,可以考虑如下结构: #### chinese_code.h 文件定义 此头文件应提供必要的宏定义、类型声明以及函数原型来帮助开发者轻松处理不同类型的字符串转换操作。 ```c #ifndef CHINESE_CODE_H_ #define CHINESE_CODE_H_ #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef _WIN32 #include <windows.h> #endif // 定义用于区分不同的编码方式 typedef enum { ENCODING_UTF8, ENCODING_GBK } EncodingType; /** * @brief 将源字符串按照指定的目标编码方式进行转码. * * @param srcStr 原始未转换的字符串指针 * @param dstBuf 存储已转换后的目标缓冲区地址 * @param sizeOfDstBuf 目标缓冲区大小 * @param fromEncoding 来源编码格式 * @param toEncoding 目的地编码格式 */ void convert_encoding(const char* srcStr, char* dstBuf, int sizeOfDstBuf, EncodingType fromEncoding, EncodingType toEncoding); #endif /* CHINESE_CODE_H_ */ ``` #### 实现细节 在实际应用中,可能还需要引入第三方库如 iconv 或 ICU 来完成复杂的编码转换工作。这里给出一个简单的基于 Windows API 的实现例子: ```cpp #include "chinese_code.h" void convert_encoding(const char* srcStr, char* dstBuf, int sizeOfDstBuf, EncodingType fromEncoding, EncodingType toEncoding){ if (!srcStr || !dstBuf || sizeOfDstBuf <= 0) return; // 使用 MultiByteToWideChar 和 WideCharToMultiByte 函数来进行编码间的相互转化 DWORD flags = MB_PRECOMPOSED | WC_NO_BEST_FIT_CHARS; int wideLen = MultiByteToWideChar((fromEncoding==ENCODING_GBK)?CP_ACP:CP_UTF8, flags, srcStr, -1, NULL, 0); wchar_t* wstr = new wchar_t[wideLen]; memset(wstr, 0, sizeof(wchar_t)*wideLen); MultiByteToWideChar((fromEncoding==ENCODING_GBK)?CP_ACP:CP_UTF8, flags, srcStr, -1, wstr, wideLen); int mbLen = WideCharToMultiByte((toEncoding==ENCODING_GBK)?CP_ACP:CP_UTF8, 0, wstr, -1, NULL, 0, NULL, FALSE); if(mbLen >= sizeOfDstBuf){ delete[] wstr; return ; } WideCharToMultiByte((toEncoding==ENCODING_GBK)?CP_ACP:CP_UTF8, 0, wstr, -1, dstBuf, mbLen, NULL, FALSE); delete[] wstr; } ``` 上述代码展示了如何利用 Windows 提供的功能将一种编码形式的数据串转变为另一种编码形式的数据串。需要注意的是,这只是一个简化版本;真实环境中应当更加严谨地对待错误情况并优化性能表现。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值