2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "MmsPluginMIME.h"
20 #include "MmsPluginCodec.h"
21 #include "MmsPluginTextConvert.h"
23 #include "MmsPluginUtil.h"
25 const char *MmsPluginTextConvertGetCharSet(int MIBEnum)
27 const char * result_str = NULL;
29 result_str = MmsGetTextByCode(MmsCodeCharSet, (unsigned short int)MIBEnum);
30 MSG_DEBUG("[MIBEnum = %d, Charset = %s]", MIBEnum, result_str);
35 bool MmsPluginTextConvert(const char *pToCodeSet, const char *pFromCodeset, const char *pSrc, int srcLen, char **ppDest, int *pDestLen)
39 gsize bytes_written = 0;
42 if (pToCodeSet == NULL || pFromCodeset == NULL) {
43 MSG_DEBUG("Error input parameter Codeset to = %s, from = %s", pToCodeSet, pFromCodeset);
47 MSG_DEBUG("Codeset to = %s, from = %s", pToCodeSet, pFromCodeset);
49 if (pSrc == NULL || ppDest == NULL || pDestLen == NULL) {
50 MSG_DEBUG("Error input parameter pSrc = %p, ppDest = %p, pDestLen = %p", pSrc, ppDest, pDestLen);
54 pDest = g_convert (pSrc, srcLen,
55 pToCodeSet, pFromCodeset,
56 &bytes_read, &bytes_written,
60 printf("Error in g_convert, GError = %d:%s, pSrc = %s\n", error->code, error->message, pSrc);
64 if (pDest == NULL || bytes_written == 0 || bytes_read == 0) {
65 printf("Error in g_convert, pDest = %s, bytes_written = %d, bytes_read = %d\n", pDest, bytes_written, bytes_read);
70 *pDestLen = bytes_written;