Isspace function Chinese error-poco library localization Error

Source: Internet
Author: User

 

The trace error occurs in the first line of the function, "_ asserte (unsigned) (C + 1) <= 256 );"

 

The explanation on the internet is:

 

I tried to use the isspace where locale is ASCII to determine GBK as a Chinese-encoded space, right? If I understand it correctly, this is not a VC issue, but a usage issue.

For C ++, isspace (CH, Loc) should be used. In this version, Loc is a variable of the type STD: locale. If you want to judge the space of GBK, so let loc be the locale of GBK, and then this function will be normal.

You are currently using the C isspace (CH) function. This function uses the default global locale. You can set this global function to GBK and solve this problem. In short, the isspace of locale, which is the default ASCII, is called to determine whether the string encoded as GBK is a space. The logic is incorrect.

 

The solution is to set encoding localization before calling this function,CodeAs follows:

STD: locale: Global (STD: locale (""));

In fact, the solution is the same as the fstream localization path.

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.