Encoding format (to be continued ...) )

Source: Internet
Author: User

1./u-> Chinese: Convert the 16 binary in the back of/U to 10, then assign to Wchar_t/byte;2. Chinese->/u:3. Utf-8: Utf-8 w/o BOM: No BOM header utf-8:3-byte BOM header, EFBBBF (utf-16 header: FFFE), belongs to Unicode encoding format;
1 //determine if there is a BOM header, and if so, remove the bow head and save it. 2  stringStrval;3  stringstrpath =cstringhelper::unicode2acsii (Cprochelper::getcurrentprocesspath ());4strpath + ="\\test_utf8.txt";5 Ifstream IFS (STRPATH.C_STR (), ios::binary);6  if(Ifs.is_open ())7  {8 StringStream SS;9SS <<ifs.rdbuf ();TenStrval =ss.str (); One ifs.close (); A  -    //determine if there is a head -    //BOM head: EFBBBF the    BOOLb =false; -    if(0xEF== (byte) strval.at (0) && -     0xBB== (byte) strval.at (1) && -     0xBF== (byte) strval.at (2)) +    { -b =true; +    } A   at   //turn around. -Strval = Strval.substr (3, Strval.length ()-3); -  -   stringStrPath2 =cstringhelper::unicode2acsii (Cprochelper::getcurrentprocesspath ()); -StrPath2 + ="\\test_utf8_bk.txt"; - ofstream ofs (strPath2, ios::binary); in   if(Ofs.is_open ()) -   { toOFS <<Strval; + ofs.close (); -   } the}

Encoding format (to be continued ...) )

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.