3 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd. All Rights Reserved.
5 * This file is part of msg-service.
7 * Contact: Jaeyun Jeong <jyjeong@samsung.com>
8 * Sangkoo Kim <sangkoo.kim@samsung.com>
9 * Seunghwan Lee <sh.cat.lee@samsung.com>
10 * SoonMin Jung <sm0415.jung@samsung.com>
11 * Jae-Young Lee <jy4710.lee@samsung.com>
12 * KeeBum Kim <keebum.kim@samsung.com>
14 * PROPRIETARY/CONFIDENTIAL
16 * This software is the confidential and proprietary information of
17 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
18 * disclose such Confidential Information and shall use it only in
19 * accordance with the terms of the license agreement you entered
20 * into with SAMSUNG ELECTRONICS.
22 * SAMSUNG make no representations or warranties about the suitability
23 * of the software, either express or implied, including but not limited
24 * to the implied warranties of merchantability, fitness for a particular
25 * purpose, or non-infringement. SAMSUNG shall not be liable for any
26 * damages suffered by licensee as a result of using, modifying or
27 * distributing this software or its derivatives.
34 #include "SmsPluginTextConvert.h"
37 /*==================================================================================================
38 IMPLEMENTATION OF MsgConvertText - Member Functions
39 ==================================================================================================*/
40 SmsPluginTextConvert* SmsPluginTextConvert::pInstance = NULL;
43 SmsPluginTextConvert* SmsPluginTextConvert::instance()
46 pInstance = new SmsPluginTextConvert();
52 int SmsPluginTextConvert::convertUTF8ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId)
55 int gsm7bitLength = 0;
60 utf8Length = strlen((char*)pSrcText);
61 srcTextLen = utf8Length;
65 utf8Length = srcTextLen;
68 int maxUCS2Length = utf8Length; // max # of UCS2 chars, NOT bytes. when all utf8 chars are only one byte, UCS2Length is maxUCS2 Length. otherwise (ex: 2 bytes of UTF8 is one char) UCS2Length must be less than utf8Length
69 WCHAR pUCS2Text[maxUCS2Length];
70 memset(pUCS2Text, 0x00, maxUCS2Length * sizeof(WCHAR));
72 MSG_DEBUG("srcTextLen = %d", srcTextLen);
73 MSG_DEBUG("temp buffer size = %d", maxUCS2Length * sizeof(WCHAR));
74 MSG_DEBUG("max dest Length = %d", maxLength);
76 ucs2Length = convertUTF8ToUCS2((unsigned char*)pUCS2Text, maxUCS2Length * sizeof(WCHAR), pSrcText, srcTextLen);
77 gsm7bitLength = convertUCS2ToGSM7bit(pDestText, maxLength, (unsigned char*)pUCS2Text, ucs2Length, pLangId);
84 if srcTextLen ispSrcText should be null terminated
86 byte length of converted UCS2 characters
89 int SmsPluginTextConvert::convertUTF8ToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
93 unsigned char *unicodeTemp = (unsigned char*)pDestText;
95 int remainedBuffer = maxLength;
99 if(maxLength == 0 || pSrcText == NULL || pDestText == NULL)
101 MSG_DEBUG("UTF8 to UCS2 Failed as text length is 0\n");
105 // null terminated string
106 if ( srcTextLen == -1 )
108 textLen = strlen((char*)pSrcText);
109 srcTextLen = textLen;
113 textLen = srcTextLen;
119 cd = g_iconv_open("UCS-2BE", "UTF8");
123 err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&unicodeTemp, (gsize*)&remainedBuffer);
128 MSG_DEBUG("Error in g_iconv.");
133 ucs2Length = maxLength - remainedBuffer;
142 int SmsPluginTextConvert::convertUTF8ToAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT MSG_ENCODE_TYPE_T *pCharType)
145 int gsm7bitLength = 0;
148 bool bUnknown = false;
150 utf8Length = srcTextLen;
152 int maxUCS2Length = utf8Length; // max # of UCS2 chars, NOT bytes. when all utf8 chars are only one byte, UCS2Length is maxUCS2 Length. otherwise (ex: 2 bytes of UTF8 is one char) UCS2Length must be less than utf8Length
153 WCHAR pUCS2Text[maxUCS2Length];
154 memset(pUCS2Text, 0x00, maxUCS2Length * sizeof(WCHAR));
156 MSG_DEBUG("srcTextLen = %d", srcTextLen);
157 MSG_DEBUG("temp buffer size = %d", maxUCS2Length * sizeof(WCHAR));
158 MSG_DEBUG("max dest Length = %d", maxLength);
160 ucs2Length = convertUTF8ToUCS2((unsigned char*)pUCS2Text, maxUCS2Length * sizeof(WCHAR), pSrcText, srcTextLen);
164 *pCharType = MSG_ENCODE_8BIT;
166 memcpy(pDestText, pSrcText, srcTextLen);
171 gsm7bitLength = convertUCS2ToGSM7bitAuto(pDestText, maxLength, (unsigned char*)pUCS2Text, ucs2Length, &bUnknown);
173 if (bUnknown == true)
175 *pCharType = MSG_ENCODE_UCS2;
178 memcpy(pDestText, pUCS2Text, ucs2Length);
184 *pCharType = MSG_ENCODE_GSM7BIT;
187 return gsm7bitLength;
194 bytelength of UTF8 text
196 int SmsPluginTextConvert::convertGSM7bitToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo)
200 int maxUCS2Length = srcTextLen; // max # of UCS2 chars, NOT bytes. when all gsm7 chars are only one byte(-there is no extenstion), UCS2Length is maxUCS2 Length. otherwise(ex: gsm7 char starts with 0x1b) UCS2Length must be less than gsm7 legnth
202 WCHAR pUCS2Text[maxUCS2Length];
203 memset(pUCS2Text, 0x00, maxUCS2Length * sizeof(WCHAR));
205 MSG_DEBUG("srcTextLen = %d\n", srcTextLen);
206 MSG_DEBUG("max dest Length = %d\n", maxLength);
208 ucs2Length = convertGSM7bitToUCS2((unsigned char*)pUCS2Text, maxUCS2Length * sizeof(WCHAR), pSrcText, srcTextLen, pLangInfo);
209 utf8Length = convertUCS2ToUTF8(pDestText, maxLength, (unsigned char*)pUCS2Text, ucs2Length);
217 OUT unsigned char *pDestText
218 IN int maxLength : max byte length of destination text
219 IN const unsigned char *pSrcText
220 IN int srcTextLen : byte length of UCS2 source text
222 byte length of converted UTF8 characters
223 -1 : The alpha isn't the gsm 7bit code
225 int SmsPluginTextConvert::convertUCS2ToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
227 int remainedBuffer = maxLength;
230 unsigned char * pTempDestText = pDestText;
232 if (srcTextLen == 0 || pSrcText == NULL || pDestText == NULL || maxLength == 0)
234 MSG_DEBUG("UCS2 to UTF8 Failed as text length is 0\n");
241 cd = g_iconv_open( "UTF8", "UCS-2BE" );
245 err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer);
248 utf8Length = maxLength - remainedBuffer;
249 pTempDestText[utf8Length] = 0x00;
257 int SmsPluginTextConvert::convertEUCKRToUTF8(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen)
259 int remainedBuffer = maxLength;
262 unsigned char * pTempDestText = pDestText;
264 if(srcTextLen == 0 || pSrcText == NULL || pDestText == NULL || maxLength == 0)
266 MSG_DEBUG("EUCKR to UTF8 Failed as text length is 0\n");
273 cd = g_iconv_open( "UTF8", "EUCKR" );
277 err = g_iconv(cd, (char**)&pSrcText, (gsize*)&srcTextLen, (char**)&pDestText, (gsize*)&remainedBuffer);
280 utf8Length = maxLength - remainedBuffer;
281 pTempDestText[utf8Length] = 0x00;
292 unsigned char *pDestText
293 int maxLength : max destination buffer size
294 const unsigned char *pSrcText
295 int srcTextLen : BYTE length of src text (UCS2)
297 bytelength of gsm7bit text
298 -1 : converting error
300 int SmsPluginTextConvert::convertUCS2ToGSM7bit(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT SMS_LANGUAGE_ID_T *pLangId)
304 unsigned char lowerByte, upperByte;
306 if (srcTextLen == 0 || pSrcText == NULL || pDestText == NULL || maxLength == 0)
308 MSG_DEBUG("UCS2 to GSM7bit Failed as text length is 0\n");
312 std::map<unsigned short, unsigned char>::iterator itChar;
313 std::map<unsigned short, unsigned char>::iterator itExt;
315 SMS_CHAR_TYPE_T currType = SMS_CHAR_DEFAULT;
316 SMS_CHAR_TYPE_T newType = SMS_CHAR_DEFAULT;
318 unsigned short inText;
320 // Get Language Type by checking each character
321 for (int index = 0; index < srcTextLen; index++)
323 upperByte = pSrcText[index++];
324 lowerByte = pSrcText[index];
326 inText = (upperByte << 8) & 0xFF00;
328 inText = inText | lowerByte;
330 itExt = extCharList.find(inText);
332 if (itExt != extCharList.end())
334 newType = (SMS_CHAR_TYPE_T)itExt->second;
336 if (newType >= currType)
343 MSG_DEBUG("charType : [%d]", currType);
345 for (int index = 0; index < srcTextLen; index++)
347 upperByte = pSrcText[index++];
348 lowerByte = pSrcText[index];
350 inText = (upperByte << 8) & 0xFF00;
351 inText = inText | lowerByte;
353 MSG_DEBUG("inText : [%04x]", inText);
355 // Check Default Char
356 itChar = ucs2toGSM7DefList.find(inText);
358 if (itChar != ucs2toGSM7DefList.end())
360 MSG_DEBUG("default char");
361 pDestText[outTextLen++] = (unsigned char)itChar->second;
365 if (currType == SMS_CHAR_GSM7EXT)
367 itExt = ucs2toGSM7ExtList.find(inText);
369 if (itExt != ucs2toGSM7ExtList.end())
371 // prevent buffer overflow
372 if (maxLength <= outTextLen + 1)
374 MSG_DEBUG("Buffer Full");
378 pDestText[outTextLen++] = 0x1B;
379 pDestText[outTextLen++] = (unsigned char)itExt->second;
383 pDestText[outTextLen++] = 0x20;
386 else if (currType == SMS_CHAR_TURKISH)
388 *pLangId = SMS_LANG_ID_TURKISH;
390 itExt = ucs2toTurkishList.find(inText);
392 if (itExt != ucs2toTurkishList.end())
394 // prevent buffer overflow
395 if (maxLength <= outTextLen + 1)
397 MSG_DEBUG("Buffer Full");
401 pDestText[outTextLen++] = 0x1B;
402 pDestText[outTextLen++] = (unsigned char)itExt->second;
406 pDestText[outTextLen++] = 0x20;
409 else if (currType == SMS_CHAR_SPANISH)
411 *pLangId = SMS_LANG_ID_SPANISH;
413 itExt = ucs2toSpanishList.find(inText);
415 if (itExt != ucs2toSpanishList.end())
417 // prevent buffer overflow
418 if (maxLength <= outTextLen + 1)
420 MSG_DEBUG("Buffer Full");
424 pDestText[outTextLen++] = 0x1B;
425 pDestText[outTextLen++] = (unsigned char)itExt->second;
429 pDestText[outTextLen++] = 0x20;
432 else if (currType == SMS_CHAR_PORTUGUESE)
434 *pLangId = SMS_LANG_ID_PORTUGUESE;
436 itExt = ucs2toPortuList.find(inText);
438 if (itExt != ucs2toPortuList.end())
440 // prevent buffer overflow
441 if (maxLength <= outTextLen + 1)
443 MSG_DEBUG("Buffer Full");
447 MSG_DEBUG("ucs2toPortuList : [%02x]", (unsigned char)itExt->second);
449 pDestText[outTextLen++] = 0x1B;
450 pDestText[outTextLen++] = (unsigned char)itExt->second;
454 MSG_DEBUG("no char");
455 pDestText[outTextLen++] = 0x20;
460 pDestText[outTextLen++] = 0x20;
464 // prevent buffer overflow
465 if (maxLength <= outTextLen)
467 MSG_DEBUG("Buffer full\n");
476 int SmsPluginTextConvert::convertUCS2ToGSM7bitAuto(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, OUT bool *pUnknown)
480 unsigned char lowerByte, upperByte;
482 if (srcTextLen == 0 || pSrcText == NULL || pDestText == NULL || maxLength == 0)
484 MSG_DEBUG("UCS2 to GSM7bit Failed as text length is 0\n");
488 std::map<unsigned short, unsigned char>::iterator itChar;
489 std::map<unsigned short, unsigned char>::iterator itExt;
491 unsigned short inText;
493 for (int index = 0; index < srcTextLen; index++)
495 upperByte = pSrcText[index++];
496 lowerByte = pSrcText[index];
498 inText = (upperByte << 8) & 0xFF00;
499 inText = inText | lowerByte;
501 // Check Default Char
502 itChar = ucs2toGSM7DefList.find(inText);
504 if (itChar != ucs2toGSM7DefList.end())
506 pDestText[outTextLen++] = (unsigned char)itChar->second;
510 itExt = ucs2toGSM7ExtList.find(inText);
512 if (itExt != ucs2toGSM7ExtList.end())
514 // prevent buffer overflow
515 if (maxLength <= outTextLen + 1)
517 MSG_DEBUG("Buffer Full");
521 pDestText[outTextLen++] = 0x1B;
522 pDestText[outTextLen++] = (unsigned char)itExt->second;
531 // prevent buffer overflow
532 if (maxLength <= outTextLen)
534 MSG_DEBUG("Buffer full\n");
545 unsigned char *pDestText : destination text (UCS2) - byte order depends on local byte order
546 const unsigned char *pSrcText : source text (gsm7bit)
547 int maxLength : max destination buffer size
548 int srcTextLen : byte length of source text (gsm7bit)
550 byte length of converted UCS2 characters
551 -1 : The alpha isn't the gsm 7bit code
553 int SmsPluginTextConvert::convertGSM7bitToUCS2(OUT unsigned char *pDestText, IN int maxLength, IN const unsigned char *pSrcText, IN int srcTextLen, IN SMS_LANG_INFO_S *pLangInfo)
556 unsigned char lowerByte = 0, upperByte = 0;
558 if (srcTextLen == 0 || pSrcText == NULL || pDestText == NULL || maxLength == 0)
560 MSG_DEBUG("UCS2 to GSM7bit Failed as text length is 0\n");
564 for (int i = 0; i<srcTextLen; i++)
571 if (pSrcText[i] >= 0x80)
574 MSG_DEBUG(">>>>>>>a_pTextString[i]=%x, The alpha isn't the gsm 7bit code, Never Come here!!!\n", pSrcText[i]);
578 if (pLangInfo->bLockingShift == true) // National Language Locking Shift
580 MSG_DEBUG("Locking Shift [%d]", pLangInfo->lockingLang);
582 if (pLangInfo->lockingLang == SMS_LANG_ID_TURKISH)
585 if (g_TurkishLockingToUCS2[pSrcText[i]] == 0x001B)
589 if (pLangInfo->bSingleShift == true) // National Language Single Shift
591 MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang);
593 if (pLangInfo->singleLang == SMS_LANG_ID_TURKISH)
595 lowerByte = g_TurkishSingleToUCS2[pSrcText[i]] & 0x00FF;
596 upperByte = (g_TurkishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
598 else if (pLangInfo->singleLang == SMS_LANG_ID_SPANISH)
600 lowerByte = g_SpanishSingleToUCS2[pSrcText[i]] & 0x00FF;
601 upperByte = (g_SpanishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
603 else if (pLangInfo->singleLang == SMS_LANG_ID_PORTUGUESE)
605 lowerByte = g_PortuSingleToUCS2[pSrcText[i]] & 0x00FF;
606 upperByte = (g_PortuSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
610 lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF;
611 upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8;
614 else // GSM 7 bit Default Alphabet Extension Table
616 lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF;
617 upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8;
620 else // TURKISH - National Language Locking Shift
622 lowerByte = g_TurkishLockingToUCS2[pSrcText[i]] & 0x00FF;
623 upperByte = (g_TurkishLockingToUCS2[pSrcText[i]] & 0xFF00) >> 8;
626 else if (pLangInfo->lockingLang == SMS_LANG_ID_PORTUGUESE)
629 if (g_PortuLockingToUCS2[pSrcText[i]] == 0x001B)
633 if (pLangInfo->bSingleShift == true) // National Language Single Shift
635 MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang);
637 if (pLangInfo->singleLang == SMS_LANG_ID_TURKISH)
639 lowerByte = g_TurkishSingleToUCS2[pSrcText[i]] & 0x00FF;
640 upperByte = (g_TurkishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
642 else if (pLangInfo->singleLang == SMS_LANG_ID_SPANISH)
644 lowerByte = g_SpanishSingleToUCS2[pSrcText[i]] & 0x00FF;
645 upperByte = (g_SpanishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
647 else if (pLangInfo->singleLang == SMS_LANG_ID_PORTUGUESE)
649 lowerByte = g_PortuSingleToUCS2[pSrcText[i]] & 0x00FF;
650 upperByte = (g_PortuSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
654 lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF;
655 upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8;
658 else // GSM 7 bit Default Alphabet Extension Table
660 lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF;
661 upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8;
664 else // PORTUGUESE - National Language Locking Shift
666 lowerByte = g_PortuLockingToUCS2[pSrcText[i]] & 0x00FF;
667 upperByte = (g_PortuLockingToUCS2[pSrcText[i]] & 0xFF00) >> 8;
674 if (g_GSM7BitToUCS2[pSrcText[i]] == 0x001B)
678 if (pLangInfo->bSingleShift == true) // National Language Single Shift
680 MSG_DEBUG("Single Shift [%d]", pLangInfo->singleLang);
682 if (pLangInfo->singleLang == SMS_LANG_ID_TURKISH)
684 lowerByte = g_TurkishSingleToUCS2[pSrcText[i]] & 0x00FF;
685 upperByte = (g_TurkishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
687 else if (pLangInfo->singleLang == SMS_LANG_ID_SPANISH)
689 lowerByte = g_SpanishSingleToUCS2[pSrcText[i]] & 0x00FF;
690 upperByte = (g_SpanishSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
692 else if (pLangInfo->singleLang == SMS_LANG_ID_PORTUGUESE)
694 lowerByte = g_PortuSingleToUCS2[pSrcText[i]] & 0x00FF;
695 upperByte = (g_PortuSingleToUCS2[pSrcText[i]] & 0xFF00) >> 8;
699 lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF;
700 upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8;
703 else // GSM 7 bit Default Alphabet Extension Table
705 lowerByte = g_GSM7BitExtToUCS2[pSrcText[i]] & 0x00FF;
706 upperByte = (g_GSM7BitExtToUCS2[pSrcText[i]] & 0xFF00) >> 8;
711 lowerByte = g_GSM7BitToUCS2[pSrcText[i]] & 0x00FF;
712 upperByte = (g_GSM7BitToUCS2[pSrcText[i]] & 0xFF00) >> 8;
716 pDestText[outTextLen++] = upperByte;
717 pDestText[outTextLen++] = lowerByte;
725 void SmsPluginTextConvert::convertDumpTextToHex(const unsigned char *pText, int length)
727 printf("\n=======================================\n");
728 printf(" Dump Text To Hex - Length :%d\n", length);
729 printf("=======================================");
731 for (int i = 0; i < length; i++ )
733 if ( i % MAX_DUMP_COLUMN == 0 )
737 printf("%02x ", pText[i]);
740 printf("\n=======================================\n\n");
744 SmsPluginTextConvert::SmsPluginTextConvert()
747 ucs2toGSM7DefList.clear();
748 ucs2toGSM7ExtList.clear();
749 ucs2toTurkishList.clear();
750 ucs2toSpanishList.clear();
751 ucs2toPortuList.clear();
753 extCharList[0x000C] = SMS_CHAR_GSM7EXT;
754 extCharList[0x005B] = SMS_CHAR_GSM7EXT;
755 extCharList[0x005C] = SMS_CHAR_GSM7EXT;
756 extCharList[0x005D] = SMS_CHAR_GSM7EXT;
757 extCharList[0x005E] = SMS_CHAR_GSM7EXT;
758 extCharList[0x007B] = SMS_CHAR_GSM7EXT;
759 extCharList[0x007C] = SMS_CHAR_GSM7EXT;
760 extCharList[0x007D] = SMS_CHAR_GSM7EXT;
761 extCharList[0x007E] = SMS_CHAR_GSM7EXT;
762 extCharList[0x20AC] = SMS_CHAR_GSM7EXT; // ��
764 extCharList[0x00E7] = SMS_CHAR_TURKISH;
765 extCharList[0x011E] = SMS_CHAR_TURKISH;
766 extCharList[0x011F] = SMS_CHAR_TURKISH;
767 extCharList[0x01E6] = SMS_CHAR_TURKISH;
768 extCharList[0x01E7] = SMS_CHAR_TURKISH;
769 extCharList[0x0130] = SMS_CHAR_TURKISH;
770 extCharList[0x0131] = SMS_CHAR_TURKISH;
771 extCharList[0x015E] = SMS_CHAR_TURKISH;
772 extCharList[0x015F] = SMS_CHAR_TURKISH;
774 extCharList[0x00C1] = SMS_CHAR_SPANISH;
775 extCharList[0x00E1] = SMS_CHAR_SPANISH;
776 extCharList[0x00CD] = SMS_CHAR_SPANISH;
777 extCharList[0x00ED] = SMS_CHAR_SPANISH;
778 extCharList[0x00D3] = SMS_CHAR_SPANISH;
779 extCharList[0x00F3] = SMS_CHAR_SPANISH;
780 extCharList[0x00DA] = SMS_CHAR_SPANISH;
781 extCharList[0x00FA] = SMS_CHAR_SPANISH;
783 extCharList[0x00D4] = SMS_CHAR_PORTUGUESE;
784 extCharList[0x00F4] = SMS_CHAR_PORTUGUESE;
785 extCharList[0x00CA] = SMS_CHAR_PORTUGUESE;
786 extCharList[0x00EA] = SMS_CHAR_PORTUGUESE;
787 extCharList[0x00C0] = SMS_CHAR_PORTUGUESE;
788 extCharList[0x00E7] = SMS_CHAR_PORTUGUESE;
789 extCharList[0x00C3] = SMS_CHAR_PORTUGUESE;
790 extCharList[0x00E3] = SMS_CHAR_PORTUGUESE;
791 extCharList[0x00D5] = SMS_CHAR_PORTUGUESE;
792 extCharList[0x00F5] = SMS_CHAR_PORTUGUESE;
793 extCharList[0x00C2] = SMS_CHAR_PORTUGUESE;
794 extCharList[0x00E2] = SMS_CHAR_PORTUGUESE;
796 for (unsigned char i = 0; i < 128; i++)
798 ucs2toGSM7DefList[g_GSM7BitToUCS2[i]] = i;
801 // GSM 7 bit Extension
802 ucs2toGSM7ExtList[0x005B] = 0x3C; // [
803 ucs2toGSM7ExtList[0x005D] = 0x3E; // ]
804 ucs2toGSM7ExtList[0x007B] = 0x28; // {
805 ucs2toGSM7ExtList[0x007D] = 0x29; // }
806 ucs2toGSM7ExtList[0x000C] = 0x0A; // Page Break
807 ucs2toGSM7ExtList[0x005C] = 0x2F; /* \ */
808 ucs2toGSM7ExtList[0x005E] = 0x14; // ^
809 ucs2toGSM7ExtList[0x007C] = 0x40; // |
810 ucs2toGSM7ExtList[0x007E] = 0x3D; // ~
811 ucs2toGSM7ExtList[0x20AC] = 0x65; // ��
814 ucs2toTurkishList[0x005B] = 0x3C; // [
815 ucs2toTurkishList[0x005D] = 0x3E; // ]
816 ucs2toTurkishList[0x007B] = 0x28; // {
817 ucs2toTurkishList[0x007D] = 0x29; // }
818 ucs2toTurkishList[0x000C] = 0x0A; // Page Break
819 ucs2toTurkishList[0x005C] = 0x2F; /* \ */
820 ucs2toTurkishList[0x005E] = 0x14; // ^
821 ucs2toTurkishList[0x007C] = 0x40; // |
822 ucs2toTurkishList[0x007E] = 0x3D; // ~
823 ucs2toTurkishList[0x20AC] = 0x65; // ��
824 ucs2toTurkishList[0x00E7] = 0x63; // c LATIN SMALL LETTER S WITH CEDILLA *
825 ucs2toTurkishList[0x011E] = 0x47; // G LATIN CAPITAL LETTER G WITH BREVE
826 ucs2toTurkishList[0x011F] = 0x67; // g LATIN SMALL LETTER G WITH BREVE
827 ucs2toTurkishList[0x01E6] = 0x47; // G LATIN CAPITAL LETTER G WITH CARON
828 ucs2toTurkishList[0x01E7] = 0x67; // g LATIN SMALL LETTER G WITH CARON
829 ucs2toTurkishList[0x0130] = 0x49; // I LATIN CAPITAL LETTER I WITH DOT ABOVE
830 ucs2toTurkishList[0x0131] = 0x69; // i LATIN SMALL LETTER DOTLESS
831 ucs2toTurkishList[0x015E] = 0x53; // S LATIN CAPITAL LETTER S WITH CEDILLA *
832 ucs2toTurkishList[0x015F] = 0x73; // s LATIN SMALL LETTER S WITH CEDILLA *
835 ucs2toSpanishList[0x005B] = 0x3C; // [
836 ucs2toSpanishList[0x005D] = 0x3E; // ]
837 ucs2toSpanishList[0x007B] = 0x28; // {
838 ucs2toSpanishList[0x007D] = 0x29; // }
839 ucs2toSpanishList[0x000C] = 0x0A; // Page Break
840 ucs2toSpanishList[0x005C] = 0x2F; /* \ */
841 ucs2toSpanishList[0x005E] = 0x14; // ^
842 ucs2toSpanishList[0x007C] = 0x40; // |
843 ucs2toSpanishList[0x007E] = 0x3D; // ~
844 ucs2toSpanishList[0x20AC] = 0x65; // ��
845 ucs2toSpanishList[0x00C1] = 0x41; // A
846 ucs2toSpanishList[0x00E1] = 0x61; // a
847 ucs2toSpanishList[0x00CD] = 0x49; // I
848 ucs2toSpanishList[0x00ED] = 0x69; // i
849 ucs2toSpanishList[0x00D3] = 0x4F; // O
850 ucs2toSpanishList[0x00F3] = 0x6F; // o
851 ucs2toSpanishList[0x00DA] = 0x55; // U
852 ucs2toSpanishList[0x00FA] = 0x75; // u
855 ucs2toPortuList[0x005B] = 0x3C; // [
856 ucs2toPortuList[0x005D] = 0x3E; // ]
857 ucs2toPortuList[0x007B] = 0x28; // {
858 ucs2toPortuList[0x007D] = 0x29; // }
859 ucs2toPortuList[0x000C] = 0x0A; // Page Break
860 ucs2toPortuList[0x005C] = 0x2F; /* \ */
861 ucs2toPortuList[0x005E] = 0x14; // ^
862 ucs2toPortuList[0x007C] = 0x40; // |
863 ucs2toPortuList[0x007E] = 0x3D; // ~
864 ucs2toPortuList[0x20AC] = 0x65; // ��
865 ucs2toPortuList[0x00D4] = 0x0B; // O
866 ucs2toPortuList[0x00F4] = 0x0C; // o
867 ucs2toPortuList[0x00C1] = 0x0E; // A
868 ucs2toPortuList[0x00E1] = 0x0F; // a
869 ucs2toPortuList[0x00CA] = 0x1F; // E
870 ucs2toPortuList[0x00EA] = 0x05; // e
871 ucs2toPortuList[0x00C0] = 0x41; // A
872 ucs2toPortuList[0x00E7] = 0x09; // c
873 ucs2toPortuList[0x00CD] = 0x49; // I
874 ucs2toPortuList[0x00ED] = 0x69; // i
875 ucs2toPortuList[0x00D3] = 0x4F; // O
876 ucs2toPortuList[0x00F3] = 0x6F; // o
877 ucs2toPortuList[0x00DA] = 0x55; // U
878 ucs2toPortuList[0x00FA] = 0x75; // u
879 ucs2toPortuList[0x00C3] = 0x61; // A
880 ucs2toPortuList[0x00E3] = 0x7B; // a
881 ucs2toPortuList[0x00D5] = 0x5C; // O
882 ucs2toPortuList[0x00F5] = 0x7C; // o
883 ucs2toPortuList[0x00C2] = 0x61; // A
884 ucs2toPortuList[0x00E2] = 0x7F; // a
885 ucs2toPortuList[0x03A6] = 0x12; // ��
886 ucs2toPortuList[0x0393] = 0x13; // ��
887 ucs2toPortuList[0x03A9] = 0x15; // ��
888 ucs2toPortuList[0x03A0] = 0x16; // ��
889 ucs2toPortuList[0x03A8] = 0x17; // ��
890 ucs2toPortuList[0x03A3] = 0x18; // ��
891 ucs2toPortuList[0x0398] = 0x19; // ��
895 SmsPluginTextConvert::~SmsPluginTextConvert()
898 ucs2toGSM7DefList.clear();
899 ucs2toGSM7ExtList.clear();
900 ucs2toTurkishList.clear();
901 ucs2toSpanishList.clear();
902 ucs2toPortuList.clear();