I use UTF8 to transfer the iconv function for GBK,
void TransContent(const char *pFromCode, const char *pToCode, const char *pInBuf, size_t iInLen, char *pOutBuf, size_t iOutLen)
{
char* sResult = NULL;
//
iconv_t hIconv = iconv_open(pToCode, pFromCode);
if (!hIconv) return;
//
size_t iRet = iconv(hIconv, (char **)(&pInBuf), &iInLen, &pOutBuf, &iOutLen);
//
iconv_close(hIconv);
}
TransContent("UTF-8", "GBK//IGNORE", "", strlen(""), pOutputBuf, sizeof(pOutputBuf));
TransContent("UTF-8", "GBK//IGNORE", "", strlen(""), pOutputBuf, sizeof(pOutputBuf));
The word "ignore" will be converted to an unknown character, and the word "" will be dropped to "". There are none of these two words in the GBK character set.
Why is one transcoded incorrectly and the other ignore??
ignore is converted to "" because it cannot be recognized, and the error code is because the system thinks it can be recognized, so the transcoding is wrong.
so what"s the difference between these two words?
https://blog.csdn.net/wang123.
I read this article saying that the word "this word is actually"\
then how to transcode in such a situation?