*/
int MsgTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
{
- int textLen;
+ gsize textLen;
unsigned char *unicodeTemp = (unsigned char*)pDestText;
- int ucs2Length = 0;
- int remainedBuffer = maxLength;
+ gsize ucs2Length = 0;
+ gsize remainedBuffer = maxLength;
#ifdef CONVERT_DUMP
int srcLen = srcTextLen;
*/
int MsgTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
{
- int remainedBuffer = maxLength;
+ gsize textLen;
+ gsize remainedBuffer = maxLength;
int utf8Length;
#ifdef CONVERT_DUMP
return false;
}
+ if ( srcTextLen == -1 ) {
+ textLen = strlen((char*)pSrcText);
+ srcTextLen = textLen;
+ } else {
+ textLen = srcTextLen;
+ }
+
GIConv cd;
int err = 0;
cd = g_iconv_open("UTF8", "UTF16BE");
if (cd > 0) {
- err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer);
+ err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&pDestText, (gsize*)&remainedBuffer);
}
if (err != 0)
int MsgTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
{
- int remainedBuffer = maxLength;
+ gsize textLen;
+ gsize remainedBuffer = maxLength;
int utf8Length;
#ifdef CONVERT_DUMP
return false;
}
+ if ( srcTextLen == -1 ) {
+ textLen = strlen((char*)pSrcText);
+ srcTextLen = textLen;
+ } else {
+ textLen = srcTextLen;
+ }
+
GIConv cd;
int err = 0;
cd = g_iconv_open("UTF8", "EUCKR");
if (cd > 0) {
- err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer);
+ err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&pDestText, (gsize*)&remainedBuffer);
}
MSG_DEBUG("g_iconv() return value = %d", err);
int MsgTextConvert::convertSHIFTJISToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
{
- int remainedBuffer = maxLength;
+ gsize textLen;
+ gsize remainedBuffer = maxLength;
int utf8Length;
#ifdef CONVERT_DUMP
return false;
}
+ if ( srcTextLen == -1 ) {
+ textLen = strlen((char*)pSrcText);
+ srcTextLen = textLen;
+ } else {
+ textLen = srcTextLen;
+ }
+
GIConv cd;
int err = 0;
cd = g_iconv_open("UTF8", "SHIFT-JIS");
if (cd > 0) {
- err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer);
+ err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&pDestText, (gsize*)&remainedBuffer);
}
MSG_DEBUG("g_iconv() return value = %d", err);