The issue occurs in the background:
There is a project through the IP to get the city needs of attribution, I was directly through the IP Attribution query interface of Sina to obtain. I'm using a shell script call
result=$ (curl-s ' http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=119.137.53.145 ')
Returns the value in JSON format:
var remote_ip_info = {"ret": 1, "Start":-1, "End":-1, "Country": "\u4e2d\u56fd", "Province": "\u5e7f\u4e1c",
"City": "\u6df1\u5733", "District": "", "ISP": "", "type": "", "desc": ""};
I used awk to intercept the 16 Unicode encoding for "\u6df1\u5733" to City.
But in the "\u6df1\u5733" into the Chinese time encountered trouble, Baidu search method is to use Iconv to convert to Utf-8 Chinese, but these methods have no effect.
Perhaps Iconv is just a character that turns characters into other character sets, while "\u6df1\u5733" is the position of the Chinese "Shenzhen" in the Unicode 16 encoding table of Chinese characters,
So to use Iconv to convert, you need to first "\u6df1\u5733" decoding into Chinese characters "Shenzhen", and then converted to other utf-8, GBK, gb2312 and other coding methods.
Iconv does not seem to decode this function.
Solution:
It took a lot of time to find a solution on the stack Voerflow website.
1. Install a uni2ascii-4.15-1.el6.rf.x86_64.rpm
2. You can then use Ascii2uni to name the conversion
ascii2uni -a U -q
# 深圳
Linux shell under 16 binary "\uxxxx" Unicode to UTF-8 Chinese