Unicode编码的 “\u5730\u65b9\u7ad9”,用iconv转换为汉字,在不知道-f选项的情况下可以全都试一遍。
#!/bin/bash for id in `iconv -l`;do echo "$id:" && echo "\u5730\u65b9\u7ad9" |iconv -f $id -t gbk ;done
结果如下:
ANSI_X3.4-1968: \u5730\u65b9\u7ad9 ANSI_X3.4-1986: \u5730\u65b9\u7ad9 ASCII: \u5730\u65b9\u7ad9 CP367: \u5730\u65b9\u7ad9 IBM367: \u5730\u65b9\u7ad9 ISO-IR-6: \u5730\u65b9\u7ad9 ISO646-US: \u5730\u65b9\u7ad9 ISO_646.IRV:1991: \u5730\u65b9\u7ad9 US: \u5730\u65b9\u7ad9 US-ASCII: \u5730\u65b9\u7ad9 CSASCII: \u5730\u65b9\u7ad9 UTF-8: \u5730\u65b9\u7ad9 ISO-10646-UCS-2: 屵UCS-2: 屵CSUNICODE: 屵UCS-2BE: 屵UNICODE-1-1: 屵UNICODEBIG: 屵CSUNICODE11: 屵UCS-2LE: 畜UNICODELITTLE: 畜ISO-10646-UCS-4: UCS-4: CSUCS4: UCS-4BE: UCS-4LE: UTF-16: 屵UTF-16BE: 屵UTF-16LE: 畜UTF-32: UTF-32BE: UTF-32LE: UNICODE-1-1-UTF-7: UTF-7: CSUNICODE11UTF7: UCS-2-INTERNAL: 畜UCS-2-SWAPPED: 屵UCS-4-INTERNAL: UCS-4-SWAPPED: C99: 地方站 JAVA: 地方站 CP819: \u5730\u65b9\u7ad9 IBM819: \u5730\u65b9\u7ad9 ISO-8859-1: \u5730\u65b9\u7ad9 ISO-IR-100: \u5730\u65b9\u7ad9 ISO8859-1: \u5730\u65b9\u7ad9 ISO_8859-1: \u5730\u65b9\u7ad9 ISO_8859-1:1987: \u5730\u65b9\u7ad9 L1: \u5730\u65b9\u7ad9 LATIN1: \u5730\u65b9\u7ad9 CSISOLATIN1: \u5730\u65b9\u7ad9 ISO-8859-2: \u5730\u65b9\u7ad9 ISO-IR-101: \u5730\u65b9\u7ad9 ISO8859-2: \u5730\u65b9\u7ad9 ISO_8859-2: \u5730\u65b9\u7ad9 ISO_8859-2:1987: \u5730\u65b9\u7ad9 L2: \u5730\u65b9\u7ad9 LATIN2: \u5730\u65b9\u7ad9 CSISOLATIN2: \u5730\u65b9\u7ad9 ISO-8859-3: \u5730\u65b9\u7ad9 ISO-IR-109: \u5730\u65b9\u7ad9 ISO8859-3: \u5730\u65b9\u7ad9 ISO_8859-3: \u5730\u65b9\u7ad9 ISO_8859-3:1988: \u5730\u65b9\u7ad9 L3: \u5730\u65b9\u7ad9 LATIN3: \u5730\u65b9\u7ad9 CSISOLATIN3: \u5730\u65b9\u7ad9 ISO-8859-4: \u5730\u65b9\u7ad9 ISO-IR-110: \u5730\u65b9\u7ad9 ISO8859-4: \u5730\u65b9\u7ad9 ISO_8859-4: \u5730\u65b9\u7ad9 ISO_8859-4:1988: \u5730\u65b9\u7ad9 L4: \u5730\u65b9\u7ad9 LATIN4: \u5730\u65b9\u7ad9 CSISOLATIN4: \u5730\u65b9\u7ad9 CYRILLIC: \u5730\u65b9\u7ad9 ISO-8859-5: \u5730\u65b9\u7ad9 ISO-IR-144: \u5730\u65b9\u7ad9 ISO8859-5: \u5730\u65b9\u7ad9 ISO_8859-5: \u5730\u65b9\u7ad9 ISO_8859-5:1988: \u5730\u65b9\u7ad9 CSISOLATINCYRILLIC: \u5730\u65b9\u7ad9 ARABIC: \u5730\u65b9\u7ad9 ASMO-708: \u5730\u65b9\u7ad9 ECMA-114: \u5730\u65b9\u7ad9 ISO-8859-6: \u5730\u65b9\u7ad9 ISO-IR-127: \u5730\u65b9\u7ad9 ISO8859-6: \u5730\u65b9\u7ad9 ISO_8859-6: \u5730\u65b9\u7ad9 ISO_8859-6:1987: \u5730\u65b9\u7ad9 CSISOLATINARABIC: \u5730\u65b9\u7ad9 ECMA-118: \u5730\u65b9\u7ad9 ELOT_928: \u5730\u65b9\u7ad9 GREEK: \u5730\u65b9\u7ad9 GREEK8: \u5730\u65b9\u7ad9 ISO-8859-7: \u5730\u65b9\u7ad9 ISO-IR-126: \u5730\u65b9\u7ad9 ISO8859-7: \u5730\u65b9\u7ad9 ISO_8859-7: \u5730\u65b9\u7ad9 ISO_8859-7:1987: \u5730\u65b9\u7ad9 ISO_8859-7:2003: \u5730\u65b9\u7ad9 CSISOLATINGREEK: \u5730\u65b9\u7ad9 HEBREW: \u5730\u65b9\u7ad9 ISO-8859-8: \u5730\u65b9\u7ad9 ISO-IR-138: \u5730\u65b9\u7ad9 ISO8859-8: \u5730\u65b9\u7ad9 ISO_8859-8: \u5730\u65b9\u7ad9 ISO_8859-8:1988: \u5730\u65b9\u7ad9 CSISOLATINHEBREW: \u5730\u65b9\u7ad9 ISO-8859-9: \u5730\u65b9\u7ad9 ISO-IR-148: \u5730\u65b9\u7ad9 ISO8859-9: \u5730\u65b9\u7ad9 ISO_8859-9: \u5730\u65b9\u7ad9 ISO_8859-9:1989: \u5730\u65b9\u7ad9 L5: \u5730\u65b9\u7ad9 LATIN5: \u5730\u65b9\u7ad9 CSISOLATIN5: \u5730\u65b9\u7ad9 ISO-8859-10: \u5730\u65b9\u7ad9 ISO-IR-157: \u5730\u65b9\u7ad9 ISO8859-10: \u5730\u65b9\u7ad9 ISO_8859-10: \u5730\u65b9\u7ad9 ISO_8859-10:1992: \u5730\u65b9\u7ad9 L6: \u5730\u65b9\u7ad9 LATIN6: \u5730\u65b9\u7ad9 CSISOLATIN6: \u5730\u65b9\u7ad9 ISO-8859-11: \u5730\u65b9\u7ad9 ISO8859-11: \u5730\u65b9\u7ad9 ISO_8859-11: \u5730\u65b9\u7ad9 ISO-8859-13: \u5730\u65b9\u7ad9 ISO-IR-179: \u5730\u65b9\u7ad9 ISO8859-13: \u5730\u65b9\u7ad9 ISO_8859-13: \u5730\u65b9\u7ad9 L7: \u5730\u65b9\u7ad9 LATIN7: \u5730\u65b9\u7ad9 ISO-8859-14: \u5730\u65b9\u7ad9 ISO-CELTIC: \u5730\u65b9\u7ad9 ISO-IR-199: \u5730\u65b9\u7ad9 ISO8859-14: \u5730\u65b9\u7ad9 ISO_8859-14: \u5730\u65b9\u7ad9 ISO_8859-14:1998: \u5730\u65b9\u7ad9 L8: \u5730\u65b9\u7ad9 LATIN8: \u5730\u65b9\u7ad9 ISO-8859-15: \u5730\u65b9\u7ad9 ISO-IR-203: \u5730\u65b9\u7ad9 ISO8859-15: \u5730\u65b9\u7ad9 ISO_8859-15: \u5730\u65b9\u7ad9 ISO_8859-15:1998: \u5730\u65b9\u7ad9 LATIN-9: \u5730\u65b9\u7ad9 ISO-8859-16: \u5730\u65b9\u7ad9 ISO-IR-226: \u5730\u65b9\u7ad9 ISO8859-16: \u5730\u65b9\u7ad9 ISO_8859-16: \u5730\u65b9\u7ad9 ISO_8859-16:2001: \u5730\u65b9\u7ad9 L10: \u5730\u65b9\u7ad9 LATIN10: \u5730\u65b9\u7ad9 KOI8-R: \u5730\u65b9\u7ad9 CSKOI8R: \u5730\u65b9\u7ad9 KOI8-U: \u5730\u65b9\u7ad9 KOI8-RU: \u5730\u65b9\u7ad9 CP1250: \u5730\u65b9\u7ad9 MS-EE: \u5730\u65b9\u7ad9 WINDOWS-1250: \u5730\u65b9\u7ad9 CP1251: \u5730\u65b9\u7ad9 MS-CYRL: \u5730\u65b9\u7ad9 WINDOWS-1251: \u5730\u65b9\u7ad9 CP1252: \u5730\u65b9\u7ad9 MS-ANSI: \u5730\u65b9\u7ad9 WINDOWS-1252: \u5730\u65b9\u7ad9 CP1253: \u5730\u65b9\u7ad9 MS-GREEK: \u5730\u65b9\u7ad9 WINDOWS-1253: \u5730\u65b9\u7ad9 CP1254: \u5730\u65b9\u7ad9 MS-TURK: \u5730\u65b9\u7ad9 WINDOWS-1254: \u5730\u65b9\u7ad9 CP1255: \u5730\u65b9\u7ad9 MS-HEBR: \u5730\u65b9\u7ad9 WINDOWS-1255: \u5730\u65b9\u7ad9 CP1256: \u5730\u65b9\u7ad9 MS-ARAB: \u5730\u65b9\u7ad9 WINDOWS-1256: \u5730\u65b9\u7ad9 CP1257: \u5730\u65b9\u7ad9 WINBALTRIM: \u5730\u65b9\u7ad9 WINDOWS-1257: \u5730\u65b9\u7ad9 CP1258: \u5730\u65b9\u7ad9 WINDOWS-1258: \u5730\u65b9\u7ad9 850: \u5730\u65b9\u7ad9 CP850: \u5730\u65b9\u7ad9 IBM850: \u5730\u65b9\u7ad9 CSPC850MULTILINGUAL: \u5730\u65b9\u7ad9 862: \u5730\u65b9\u7ad9 CP862: \u5730\u65b9\u7ad9 IBM862: \u5730\u65b9\u7ad9 CSPC862LATINHEBREW: \u5730\u65b9\u7ad9 866: \u5730\u65b9\u7ad9 CP866: \u5730\u65b9\u7ad9 IBM866: \u5730\u65b9\u7ad9 CSIBM866: \u5730\u65b9\u7ad9 CP1131: \u5730\u65b9\u7ad9 MAC: \u5730\u65b9\u7ad9 MACINTOSH: \u5730\u65b9\u7ad9 MACROMAN: \u5730\u65b9\u7ad9 CSMACINTOSH: \u5730\u65b9\u7ad9 MACCENTRALEUROPE: \u5730\u65b9\u7ad9 MACICELAND: \u5730\u65b9\u7ad9 MACCROATIAN: \u5730\u65b9\u7ad9 MACROMANIA: \u5730\u65b9\u7ad9 MACCYRILLIC: \u5730\u65b9\u7ad9 MACUKRAINE: \u5730\u65b9\u7ad9 MACGREEK: \u5730\u65b9\u7ad9 MACTURKISH: \u5730\u65b9\u7ad9 MACHEBREW: \u5730\u65b9\u7ad9 MACARABIC: \u5730\u65b9\u7ad9 MACTHAI: \u5730\u65b9\u7ad9 HP-ROMAN8: \u5730\u65b9\u7ad9 R8: \u5730\u65b9\u7ad9 ROMAN8: \u5730\u65b9\u7ad9 CSHPROMAN8: \u5730\u65b9\u7ad9 NEXTSTEP: \u5730\u65b9\u7ad9 ARMSCII-8: \u5730\u65b9\u7ad9 GEORGIAN-ACADEMY: \u5730\u65b9\u7ad9 GEORGIAN-PS: \u5730\u65b9\u7ad9 KOI8-T: \u5730\u65b9\u7ad9 CP154: \u5730\u65b9\u7ad9 CYRILLIC-ASIAN: \u5730\u65b9\u7ad9 PT154: \u5730\u65b9\u7ad9 PTCP154: \u5730\u65b9\u7ad9 CSPTCP154: \u5730\u65b9\u7ad9 KZ-1048: \u5730\u65b9\u7ad9 RK1048: \u5730\u65b9\u7ad9 STRK1048-2002: \u5730\u65b9\u7ad9 CSKZ1048: \u5730\u65b9\u7ad9 MULELAO-1: \u5730\u65b9\u7ad9 CP1133: \u5730\u65b9\u7ad9 IBM-CP1133: \u5730\u65b9\u7ad9 ISO-IR-166: \u5730\u65b9\u7ad9 TIS-620: \u5730\u65b9\u7ad9 TIS620: \u5730\u65b9\u7ad9 TIS620-0: \u5730\u65b9\u7ad9 TIS620.2529-1: \u5730\u65b9\u7ad9 TIS620.2533-0: \u5730\u65b9\u7ad9 TIS620.2533-1: \u5730\u65b9\u7ad9 CP874: \u5730\u65b9\u7ad9 WINDOWS-874: \u5730\u65b9\u7ad9 VISCII: \u5730\u65b9\u7ad9 VISCII1.1-1: \u5730\u65b9\u7ad9 CSVISCII: \u5730\u65b9\u7ad9 TCVN: \u5730\u65b9\u7ad9 TCVN-5712: \u5730\u65b9\u7ad9 TCVN5712-1: \u5730\u65b9\u7ad9 TCVN5712-1:1993: \u5730\u65b9\u7ad9 ISO-IR-14: ISO646-JP: JIS_C6220-1969-RO: JP: CSISO14JISC6220RO: JISX0201-1976: JIS_X0201: X0201: CSHALFWIDTHKATAKANA: ISO-IR-87: 橦儀外橦教盥橦戟箙JIS0208: 橦儀外橦教盥橦戟箙JIS_C6226-1983: 橦儀外橦教盥橦戟箙JIS_X0208: 橦儀外橦教盥橦戟箙JIS_X0208-1983: 橦儀外橦教盥橦戟箙JIS_X0208-1990: 橦儀外橦教盥橦戟箙X0208: 橦儀外橦教盥橦戟箙CSISO87JISX0208: 橦儀外橦教盥橦戟箙ISO-IR-159: 襜咻刁襜嘰鄈襜垧鋈JIS_X0212: 襜咻刁襜嘰鄈襜垧鋈JIS_X0212-1990: 襜咻刁襜嘰鄈襜垧鋈JIS_X0212.1990-0: 襜咻刁襜嘰鄈襜垧鋈X0212: 襜咻刁襜嘰鄈襜垧鋈CSISO159JISX02121990: 襜咻刁襜嘰鄈襜垧鋈CN: \u5730\u65b9\u7ad9 GB_1988-80: \u5730\u65b9\u7ad9 ISO-IR-57: \u5730\u65b9\u7ad9 ISO646-CN: \u5730\u65b9\u7ad9 CSISO57GB1988: \u5730\u65b9\u7ad9 CHINESE: 荃捣嘲荃兜夤荃丰涔GB_2312-80: 荃捣嘲荃兜夤荃丰涔ISO-IR-58: 荃捣嘲荃兜夤荃丰涔CSISO58GB231280: 荃捣嘲荃兜夤荃丰涔CN-GB-ISOIR165: 荃捣嘲荃兜夤荃丰涔ISO-IR-165: 荃捣嘲荃兜夤荃丰涔ISO-IR-149: 付KOREAN: 付KSC_5601: 付KS_C_5601-1987: 付KS_C_5601-1989: 付CSKSC56011987: 付EUC-JP: \u5730\u65b9\u7ad9 EUCJP: \u5730\u65b9\u7ad9 EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE: \u5730\u65b9\u7ad9 CSEUCPKDFMTJAPANESE: \u5730\u65b9\u7ad9 MS_KANJI: SHIFT-JIS: SHIFT_JIS: SJIS: CSSHIFTJIS: CP932: \u5730\u65b9\u7ad9 ISO-2022-JP: \u5730\u65b9\u7ad9 CSISO2022JP: \u5730\u65b9\u7ad9 ISO-2022-JP-1: \u5730\u65b9\u7ad9 ISO-2022-JP-2: \u5730\u65b9\u7ad9 CSISO2022JP2: \u5730\u65b9\u7ad9 CN-GB: \u5730\u65b9\u7ad9 EUC-CN: \u5730\u65b9\u7ad9 EUCCN: \u5730\u65b9\u7ad9 GB2312: \u5730\u65b9\u7ad9 CSGB2312: \u5730\u65b9\u7ad9 GBK: \u5730\u65b9\u7ad9 CP936: \u5730\u65b9\u7ad9 MS936: \u5730\u65b9\u7ad9 WINDOWS-936: \u5730\u65b9\u7ad9 GB18030: \u5730\u65b9\u7ad9 ISO-2022-CN: \u5730\u65b9\u7ad9 CSISO2022CN: \u5730\u65b9\u7ad9 ISO-2022-CN-EXT: \u5730\u65b9\u7ad9 HZ: \u5730\u65b9\u7ad9 HZ-GB-2312: \u5730\u65b9\u7ad9 EUC-TW: \u5730\u65b9\u7ad9 EUCTW: \u5730\u65b9\u7ad9 CSEUCTW: \u5730\u65b9\u7ad9 BIG-5: \u5730\u65b9\u7ad9 BIG-FIVE: \u5730\u65b9\u7ad9 BIG5: \u5730\u65b9\u7ad9 BIGFIVE: \u5730\u65b9\u7ad9 CN-BIG5: \u5730\u65b9\u7ad9 CSBIG5: \u5730\u65b9\u7ad9 CP950: \u5730\u65b9\u7ad9 BIG5-HKSCS:1999: \u5730\u65b9\u7ad9 BIG5-HKSCS:2001: \u5730\u65b9\u7ad9 BIG5-HKSCS:2004: \u5730\u65b9\u7ad9 BIG5-HKSCS: \u5730\u65b9\u7ad9 BIG5-HKSCS:2008: \u5730\u65b9\u7ad9 BIG5HKSCS: \u5730\u65b9\u7ad9 EUC-KR: \u5730\u65b9\u7ad9 EUCKR: \u5730\u65b9\u7ad9 CSEUCKR: \u5730\u65b9\u7ad9 CP949: \u5730\u65b9\u7ad9 UHC: \u5730\u65b9\u7ad9 CP1361: JOHAB: ISO-2022-KR: \u5730\u65b9\u7ad9 CSISO2022KR: \u5730\u65b9\u7ad9 CP856: \u5730\u65b9\u7ad9 CP922: \u5730\u65b9\u7ad9 CP943: \u5730\u65b9\u7ad9 CP1046: \u5730\u65b9\u7ad9 CP1124: \u5730\u65b9\u7ad9 CP1129: \u5730\u65b9\u7ad9 CP1161: \u5730\u65b9\u7ad9 IBM-1161: \u5730\u65b9\u7ad9 IBM1161: \u5730\u65b9\u7ad9 CSIBM1161: \u5730\u65b9\u7ad9 CP1162: \u5730\u65b9\u7ad9 IBM-1162: \u5730\u65b9\u7ad9 IBM1162: \u5730\u65b9\u7ad9 CSIBM1162: \u5730\u65b9\u7ad9 CP1163: \u5730\u65b9\u7ad9 IBM-1163: \u5730\u65b9\u7ad9 IBM1163: \u5730\u65b9\u7ad9 CSIBM1163: \u5730\u65b9\u7ad9 DEC-KANJI: \u5730\u65b9\u7ad9 DEC-HANYU: \u5730\u65b9\u7ad9 437: \u5730\u65b9\u7ad9 CP437: \u5730\u65b9\u7ad9 IBM437: \u5730\u65b9\u7ad9 CSPC8CODEPAGE437: \u5730\u65b9\u7ad9 CP737: \u5730\u65b9\u7ad9 CP775: \u5730\u65b9\u7ad9 IBM775: \u5730\u65b9\u7ad9 CSPC775BALTIC: \u5730\u65b9\u7ad9 852: \u5730\u65b9\u7ad9 CP852: \u5730\u65b9\u7ad9 IBM852: \u5730\u65b9\u7ad9 CSPCP852: \u5730\u65b9\u7ad9 CP853: \u5730\u65b9\u7ad9 855: \u5730\u65b9\u7ad9 CP855: \u5730\u65b9\u7ad9 IBM855: \u5730\u65b9\u7ad9 CSIBM855: \u5730\u65b9\u7ad9 857: \u5730\u65b9\u7ad9 CP857: \u5730\u65b9\u7ad9 IBM857: \u5730\u65b9\u7ad9 CSIBM857: \u5730\u65b9\u7ad9 CP858: \u5730\u65b9\u7ad9 860: \u5730\u65b9\u7ad9 CP860: \u5730\u65b9\u7ad9 IBM860: \u5730\u65b9\u7ad9 CSIBM860: \u5730\u65b9\u7ad9 861: \u5730\u65b9\u7ad9 CP-IS: \u5730\u65b9\u7ad9 CP861: \u5730\u65b9\u7ad9 IBM861: \u5730\u65b9\u7ad9 CSIBM861: \u5730\u65b9\u7ad9 863: \u5730\u65b9\u7ad9 CP863: \u5730\u65b9\u7ad9 IBM863: \u5730\u65b9\u7ad9 CSIBM863: \u5730\u65b9\u7ad9 CP864: \u5730\u65b9\u7ad9 IBM864: \u5730\u65b9\u7ad9 CSIBM864: \u5730\u65b9\u7ad9 865: \u5730\u65b9\u7ad9 CP865: \u5730\u65b9\u7ad9 IBM865: \u5730\u65b9\u7ad9 CSIBM865: \u5730\u65b9\u7ad9 869: \u5730\u65b9\u7ad9 CP-GR: \u5730\u65b9\u7ad9 CP869: \u5730\u65b9\u7ad9 IBM869: \u5730\u65b9\u7ad9 CSIBM869: \u5730\u65b9\u7ad9 CP1125: \u5730\u65b9\u7ad9 EUC-JIS-2004: \u5730\u65b9\u7ad9 EUC-JISX0213: \u5730\u65b9\u7ad9 SHIFT_JIS-2004: SHIFT_JISX0213: ISO-2022-JP-2004: \u5730\u65b9\u7ad9 ISO-2022-JP-3: \u5730\u65b9\u7ad9 BIG5-2003: \u5730\u65b9\u7ad9 ISO-IR-230: Yr5730Yr65b9Yr7ad9 TDS565: Yr5730Yr65b9Yr7ad9 ATARI: \u5730\u65b9\u7ad9 ATARIST: \u5730\u65b9\u7ad9 RISCOS-LATIN1: \u5730\u65b9\u7ad9
可以看到C99和JAVA返回了正确结果。
关于C99和JAVA
关于iconv的能力
It provides support for the encodings:
...
Full Unicode
UTF-8
UCS-2, UCS-2BE, UCS-2LE
UCS-4, UCS-4BE, UCS-4LE
UTF-16, UTF-16BE, UTF-16LE
UTF-32, UTF-32BE, UTF-32LE
UTF-7
C99, JAVA
发表回复