Encoding format in IOS-char * convert Chinese characters to NSString *

Source: Internet
Author: User
Tags mac mail

Char * To NSString * NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding (kCFStringEncodingGB_18030_2000); char * c_test = "first"; int nLen = strlen (c_test ); NSString * str = [[NSString alloc] initWithBytes: c_test length: nLen encoding: enc]; create a mac OS project and add the Code: [cpp] view plaincopy const NSStringEncoding * encodings = [NSString availableStringEncodings]; NSMutableString * str = [NSMutableString all Oc] init]; NSStringEncoding encoding; while (encoding = * encodings ++ )! = 0) {[str appendFormat: @ "% @ = % li \ n", [NSString localizedNameOfStringEncoding: encoding], encoding];} NSLog (@ "% @", str); get: Western (Mac OS Roman) === 30 Japanese (Mac OS) === 2147483649 Traditional Chinese (Mac OS) === 2147483650 Korean (Mac OS) === 2147483651 Arabic (Mac OS) === 2147483652 Hebrew (Mac OS) === 2147483653 Greek (Mac OS) === 2147483654 Cyrillic (Mac OS) === 2147483655 Devanagari (Mac OS) === 2147483657 Gurmukhi (Mac OS) === 2147483658 Gujarati (Mac OS) === 2147483659 Thai (Mac OS) === 2147483669 Simplified Chinese (Mac OS) === 2147483673 Tibetan (Mac OS) === 2147483674 Central European (Mac OS) === 2147483677 Symbol (Mac OS) === 6 Dingbats (Mac OS) === 2147483682 Turkish (Mac OS) === 2147483683 Croatian (Mac OS) === 2147483684 Icelandic (Mac OS) === 2147483685 Romanian (Mac OS) === 2147483686 Celtic (Mac OS) === 2147483687 Gaelic (Mac OS) === 2147483688 Keyboard Symbols (Mac OS) === 2147483689 Farsi (Mac OS) === 2147483788 Cyrillic (Mac OS Ukrainian) === 2147483800 Inuit (Mac OS) === 2147483884 Unicode (UTF-16) = 10 Unicode (UTF-7) = 2214592768 Unicode (UTF-8) = 4 Unicode (UTF-32) = 2348810496 Unicode (UTF-16BE) = 2415919360 Unicode (UTF-16LE) === 2483028224 Unicode (UTF-32BE) === 2550137088 Unicode (UTF-32LE) === 2617245952 Western (ISO Latin 1) === 5 Central European (ISO Latin 2) === 9 Western (ISO Latin 3) === 2147484163 Central European (ISO Latin 4) === 2147484164 Cyrillic (ISO 8859-5) === 2147484165 Arabic (ISO 8859-6) === 2147484166 Greek (ISO 8859-7) === 2147484167 Hebrew (ISO 8859-8) === 2147484168 Turkish (ISO Latin 5) === 2147484169 Nordic (ISO Latin 6) === 2147484170 Thai (ISO 8859-11) === 2147484171 Baltic (ISO Latin 7) === 2147484173 Celtic (ISO Latin 8) === 2147484174 Western (ISO Latin 9) === 2147484175 Romanian (ISO Latin 10) === 2147482136latin-us (DOS) === 2147484672 Greek (DOS) === 2147484677 Baltic (DOS) === 2147484678 Western (DOS Latin 1) === 2147484688 Greek (DOS Greek 1) === 2147484689 Central European (DOS Latin 2) === 2147484690 Cyrillic (DOS) === 2147484691 Turkish (DOS) === 2147484692 Portuguese (DOS) === 2147484693 Icelandic (DOS) === 2147484694 Hebrew (DOS) === 2147484695 Canadian French (DOS) === 2147484696 Arabic (DOS) === 2147484697 Nordic (DOS) === 2147484698 Russian (DOS) === 2147484699 Greek (DOS Greek 2) === 2147484700 Thai (Windows, DOS) === 2147484701 japan ese (Windows, DOS) === 8 Simplified Chinese (Windows, DOS) === 2147484705 Korean (Windows, DOS) === 2147484706 Traditional Chinese (Windows, DOS) === 2147484707 Western (Windows Latin 1) === 12 Central European (Windows Latin 2) === 15 Cyrillic (Windows) === 11 Greek (Windows) === 13 Turkish (Windows Latin 5) === 14 Hebrew (Windows) === 2147484933 Arabic (Windows) === 2147484934 Baltic (Windows) === 2147484935 Vietnamese (Windows) === 2147484936 Western (ASCII) === 1 Japanese ESE (Shift JIS X0213) === 2147485224 Chinese (GBK) === 2147485233 Chinese (GB 18030) === 2147485234 Japanese ESE (ISO 2022-JP) === 21 japan ese (ISO 2022-JP-2) === 2147485729 japan ese (ISO 2022-JP-1) === 2147485730 Chinese (ISO 2022-CN) === 2147485744 Korean (ISO 2022-KR) === 2147485760 japan ese (EUC) === 3 Simplified Chinese (GB 2312) === 2147486000 Traditional Chinese (EUC) === 2147486001 Korean (EUC) === 2147486016 japan ese (Shift JIS) === 2147486209 Cyrillic (KOI8-R) === 2147486210 Traditional Chinese (Big 5) === 2147486211 Western (Mac Mail) === 2147486212 Simplified Chinese (hz gb 2312) === 2147486213 Traditional Chinese (Big 5 HKSCS) === 2147486214 Ukrainian (KOI8-U) === 2147486216 Traditional Chinese (Big 5-E) === 2147486217 Western (NextStep) === 2Non-lossy ASCII === 7 Western (EBCDIC Latin Core) === 2147486721 Western (EBCDIC Latin 1) === 2147486722

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.