smsprotocols/smsstack/gsmu/src/Gsmuelem.cpp
changeset 53 12b52b1a573e
parent 44 8b72faa1200f
equal deleted inserted replaced
52:60785a088077 53:12b52b1a573e
  1397 		}
  1397 		}
  1398 	} // CSmsAlphabetConverter::ConvertToNativeL
  1398 	} // CSmsAlphabetConverter::ConvertToNativeL
  1399 
  1399 
  1400 
  1400 
  1401 /**
  1401 /**
  1402  *  Tests if the character is supported by the current character set.
       
  1403  *  This function can be used with 7bit and 8bit alphabets.
       
  1404  * 
       
  1405  *  @param aChar  Character to investigate.
       
  1406  * 
       
  1407  *  @return  ETrue if the character is supported.
       
  1408  * 
       
  1409  *  @note Since the function is based on the old behaviour (pre-PREQ2090)
       
  1410  *        it does not accept a downgraded character or alternative encoding
       
  1411  *        as being supported.
       
  1412  */
       
  1413 TBool CSmsAlphabetConverter::IsSupportedL(TChar aChar)
       
  1414 	{
       
  1415 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL_1, "[1] CSmsAlphabetConverter::IsSupportedL(aChar=0x%04x)", (TUint) aChar);
       
  1416 
       
  1417 	TBool isDowngrade, isRequiresAlternativeEncoding;
       
  1418 
       
  1419     TBool  supported = IsSupportedL(aChar, ESmsEncodingNone,
       
  1420             isDowngrade, isRequiresAlternativeEncoding);
       
  1421 	
       
  1422 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL_2, "CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
       
  1423 
       
  1424 	return supported;
       
  1425 	} // CSmsAlphabetConverter::IsSupportedL
       
  1426 
       
  1427 
       
  1428 /**
       
  1429  *  Tests if the descriptor text is supported by the current character set.
  1402  *  Tests if the descriptor text is supported by the current character set.
  1430  *  This function can be used with 7bit and 8bit alphabets.
  1403  *  This function can be used with 7bit and 8bit alphabets.
  1431  * 
  1404  * 
  1432  *  @param aDes                                 Text string to check.
  1405  *  @param aDes                                 Text string to check.
  1433  *  @param aNumberOfUnconvertibleCharacters     Exit param for the number of
  1406  *  @param aNumberOfUnconvertibleCharacters     Exit param for the number of
  1438  *  @return  ETrue if the character is supported.
  1411  *  @return  ETrue if the character is supported.
  1439  */
  1412  */
  1440 TBool CSmsAlphabetConverter::IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters,
  1413 TBool CSmsAlphabetConverter::IsSupportedL(const TDesC& aDes, TInt& aNumberOfUnconvertibleCharacters,
  1441                                           TInt& aIndexOfFirstUnconvertibleCharacter)
  1414                                           TInt& aIndexOfFirstUnconvertibleCharacter)
  1442 	{
  1415 	{
  1443 	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_1, "[2] CSmsAlphabetConverter::IsSupportedL(aDes=\"%S\")", aDes);
  1416 	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL_1, "[1] CSmsAlphabetConverter::IsSupportedL(aDes=\"%S\")", aDes);
  1444 
  1417 
  1445 	TInt desLength = aDes.Length();
  1418 	TInt desLength = aDes.Length();
  1446 	//
       
  1447 	// Initialise the exit params...
       
  1448 	//
       
  1449 	aNumberOfUnconvertibleCharacters    = 0;
       
  1450 	aIndexOfFirstUnconvertibleCharacter = desLength;
       
  1451 
  1419 
  1452     //
  1420     //
  1453     // Create buffers for the input converted to 7Bit and a buffer for it once
  1421     // Create buffer for restored text string...
  1454     // converted back again...
       
  1455     //
  1422     //
  1456     HBufC8* encodedBuf       = HBufC8::NewLC(desLength*2); // worse case
       
  1457     HBufC*  backToUnicodeAfterStdBuf = HBufC::NewLC(desLength);
  1423     HBufC*  backToUnicodeAfterStdBuf = HBufC::NewLC(desLength);
  1458     TPtr8  encoded(encodedBuf->Des());
       
  1459     TPtr  backToUnicodeAfterStd(backToUnicodeAfterStdBuf->Des());
  1424     TPtr  backToUnicodeAfterStd(backToUnicodeAfterStdBuf->Des());
  1460 
       
  1461     //
       
  1462     // Convert the input string to standard 7bit (with downgrades if needed)...
       
  1463     // 
       
  1464     PrepareForConversionFromNativeL(ESmsEncodingNone);
       
  1465 
       
  1466     TInt  notConverted = iCharacterSetConverter.ConvertFromUnicode(encoded, aDes);
       
  1467 
       
  1468     if (notConverted > 0)
       
  1469         {
       
  1470         aNumberOfUnconvertibleCharacters += notConverted;
       
  1471         }
       
  1472     else if (notConverted < 0)
       
  1473         {
       
  1474         aNumberOfUnconvertibleCharacters = desLength;
       
  1475         }
       
  1476     
  1425     
  1477     //
  1426     //
  1478     // Convert it back again to the native format...
  1427     // Convert the string...
  1479     //
  1428     //   
  1480     TInt  state       = CCnvCharacterSetConverter::KStateDefault;
  1429 	TInt numberOfDowngradedCharacters;
  1481     TInt  notRestored = iCharacterSetConverter.ConvertToUnicode(backToUnicodeAfterStd, encoded, state);
  1430 	TBool isCountDowngrade = EFalse; // Don't count downgrades
  1482 
  1431 	ConvertWith7BitEncodingL(aDes, backToUnicodeAfterStd, 
  1483     if (notRestored > 0)
  1432             aNumberOfUnconvertibleCharacters, numberOfDowngradedCharacters, 
  1484         {
  1433             aIndexOfFirstUnconvertibleCharacter, isCountDowngrade);
  1485         aNumberOfUnconvertibleCharacters += notRestored;
  1434 	
  1486         }
       
  1487     else if (notRestored < 0)
       
  1488         {
       
  1489         aNumberOfUnconvertibleCharacters = desLength;
       
  1490         }
       
  1491 
       
  1492     //
       
  1493     // Work out if the string is acceptable as it is (e.g. no unconvertible
       
  1494     // and no downgrades). We only need do this if the previous conversions were
       
  1495     // complete with no issues.
       
  1496     //
       
  1497     for (TInt pos = desLength-1;  pos >= 0;  --pos)
       
  1498         {
       
  1499         if (backToUnicodeAfterStd[pos] != aDes[pos])
       
  1500             {
       
  1501             aNumberOfUnconvertibleCharacters++;
       
  1502             aIndexOfFirstUnconvertibleCharacter = pos;
       
  1503             }
       
  1504         }
       
  1505     
       
  1506     CleanupStack::PopAndDestroy(backToUnicodeAfterStdBuf);
  1435     CleanupStack::PopAndDestroy(backToUnicodeAfterStdBuf);
  1507     CleanupStack::PopAndDestroy(encodedBuf);
       
  1508 	
  1436 	
  1509 	//
       
  1510 	// Useful logging...
       
  1511 	//
       
  1512 	TBool  supported = (aNumberOfUnconvertibleCharacters == 0);
  1437 	TBool  supported = (aNumberOfUnconvertibleCharacters == 0);
  1513 
  1438 
  1514 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_2, "CSmsAlphabetConverter::IsSupportedL(): aNumberOfUnconvertibleCharacters=%d.", aNumberOfUnconvertibleCharacters);
  1439 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL_2, "CSmsAlphabetConverter::IsSupportedL(): aNumberOfUnconvertibleCharacters=%d.", aNumberOfUnconvertibleCharacters);
  1515 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_3, "CSmsAlphabetConverter::IsSupportedL(): aIndexOfFirstUnconvertibleCharacter=%d.", aIndexOfFirstUnconvertibleCharacter);
  1440 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL_3, "CSmsAlphabetConverter::IsSupportedL(): aIndexOfFirstUnconvertibleCharacter=%d.", aIndexOfFirstUnconvertibleCharacter);
  1516 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_4, "CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
  1441 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL_4, "CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
  1517 
       
  1518 	return supported;
       
  1519 	} // CSmsAlphabetConverter::IsSupportedL
       
  1520 
       
  1521 
       
  1522 /**
       
  1523  *  Tests if the character is supported by the current character set.
       
  1524  *  This function can be used with 7bit and 8bit alphabets.
       
  1525  * 
       
  1526  *  @param aChar                         Character to investigate.
       
  1527  *  @param aEncoding                     Alternative 7bit encoding (if used).
       
  1528  *  @param aIsDowngrade                  Exit param set to ETrue if the
       
  1529  *                                       character has to be downgraded.
       
  1530  *  @param aRequiresAlternativeEncoding  Exit param set to ETrue if the
       
  1531  *                                       alternative encoding has to be
       
  1532  *                                       used to encode it.
       
  1533  * 
       
  1534  *  @return  ETrue if the character is supported.
       
  1535  */
       
  1536 TBool CSmsAlphabetConverter::IsSupportedL(TChar aChar, TSmsEncoding aEncoding,
       
  1537 		                                  TBool& aIsDowngrade,
       
  1538                                           TBool& aRequiresAlternativeEncoding)
       
  1539 	{
       
  1540 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL2_1, "[3] CSmsAlphabetConverter::IsSupportedL(aChar=0x%04x)", (TUint) aChar);
       
  1541 
       
  1542 	//
       
  1543 	// Convert the character...
       
  1544 	//
       
  1545 	TInt  numberOfUnconvertibleCharacters, numberOfDowngradedCharacters, 
       
  1546             numberRequiringAlternativeEncoding, indexOfFirstUnconvertibleCharacter;
       
  1547 	TBuf<4>   toEncode;
       
  1548 
       
  1549 	toEncode.SetLength(1);
       
  1550 	toEncode[0]=(TText)aChar;
       
  1551 
       
  1552 	TBool supported = IsSupportedL(toEncode, aEncoding, 
       
  1553 	        numberOfUnconvertibleCharacters,
       
  1554 	        numberOfDowngradedCharacters,
       
  1555 	        numberRequiringAlternativeEncoding,
       
  1556 	        indexOfFirstUnconvertibleCharacter);
       
  1557 
       
  1558 	//
       
  1559 	// Calculate the exit params...
       
  1560 	//
       
  1561 	aIsDowngrade                 = (numberOfDowngradedCharacters > 0);
       
  1562 	aRequiresAlternativeEncoding = (numberRequiringAlternativeEncoding > 0);
       
  1563 	    
       
  1564 	//
       
  1565 	// Useful logging...
       
  1566 	//
       
  1567 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL2_2, "CSmsAlphabetConverter::IsSupportedL(): aIsDowngrade=%d.", aIsDowngrade);
       
  1568 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL2_3, "CSmsAlphabetConverter::IsSupportedL(): aRequiresAlternativeEncoding=%d.", aRequiresAlternativeEncoding);
       
  1569 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL2_4, "CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
       
  1570 
  1442 
  1571 	return supported;
  1443 	return supported;
  1572 	} // CSmsAlphabetConverter::IsSupportedL
  1444 	} // CSmsAlphabetConverter::IsSupportedL
  1573 
  1445 
  1574 
  1446 
  1594 										  TInt& aNumberOfUnconvertibleCharacters,
  1466 										  TInt& aNumberOfUnconvertibleCharacters,
  1595                                           TInt& aNumberOfDowngradedCharacters,
  1467                                           TInt& aNumberOfDowngradedCharacters,
  1596                                           TInt& aNumberRequiringAlternativeEncoding,
  1468                                           TInt& aNumberRequiringAlternativeEncoding,
  1597                                           TInt& aIndexOfFirstUnconvertibleCharacter)
  1469                                           TInt& aIndexOfFirstUnconvertibleCharacter)
  1598 	{
  1470 	{
  1599 	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL3_1, "[4] CSmsAlphabetConverter::IsSupportedL(aDes=\"%S\")", aDes);
  1471 	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_1, "[2] CSmsAlphabetConverter::IsSupportedL(aDes=\"%S\")", aDes);
  1600 
  1472 
  1601 	TInt desLength = aDes.Length();
  1473 	TInt desLength = aDes.Length();
  1602 	//
  1474 	//
  1603 	// Initialise the exit params...
  1475 	// Initialise the exit param...
  1604 	//
  1476 	//
  1605 	aNumberOfUnconvertibleCharacters    = 0;
       
  1606 	aNumberOfDowngradedCharacters       = 0;
       
  1607 	aNumberRequiringAlternativeEncoding = 0;
  1477 	aNumberRequiringAlternativeEncoding = 0;
  1608 	aIndexOfFirstUnconvertibleCharacter = desLength;
       
  1609 	
  1478 	
  1610 	//
  1479 	//
  1611 	// Create buffers for the input converted to 7Bit and a buffer for it once
  1480 	// Create buffer for restored text string...
  1612 	// converted back again...
       
  1613 	//
  1481 	//
  1614     HBufC8* encodedBuf       = HBufC8::NewLC(desLength*2); // worse case
       
  1615     HBufC*  backToUnicodeAfterStdBuf = HBufC::NewLC(desLength);
  1482     HBufC*  backToUnicodeAfterStdBuf = HBufC::NewLC(desLength);
  1616     TPtr8  encoded(encodedBuf->Des());
       
  1617     TPtr  backToUnicodeAfterStd(backToUnicodeAfterStdBuf->Des());
  1483     TPtr  backToUnicodeAfterStd(backToUnicodeAfterStdBuf->Des());
  1618 
  1484     TBool  isCountDowngrade = ETrue; // Count downgraded chars
  1619     //
       
  1620     // Convert the input string to standard 7bit (with downgrades if needed)...
       
  1621     // 
       
  1622     PrepareForConversionFromNativeL(ESmsEncodingNone);
       
  1623 
       
  1624     TInt  notConverted = iCharacterSetConverter.ConvertFromUnicode(encoded, aDes);
       
  1625 
       
  1626     if (notConverted > 0)
       
  1627         {
       
  1628         aNumberOfUnconvertibleCharacters += notConverted;
       
  1629         }
       
  1630     else if (notConverted < 0)
       
  1631         {
       
  1632         aNumberOfUnconvertibleCharacters = desLength;
       
  1633         }
       
  1634     
  1485     
  1635     //
  1486     //
  1636     // Convert it back again to the native format...
  1487     // Convert the character...
  1637     //
  1488     //   
  1638     TInt  state       = CCnvCharacterSetConverter::KStateDefault;
  1489     ConvertWith7BitEncodingL(aDes, backToUnicodeAfterStd, 
  1639     TInt  notRestored = iCharacterSetConverter.ConvertToUnicode(backToUnicodeAfterStd, encoded, state);
  1490             aNumberOfUnconvertibleCharacters, aNumberOfDowngradedCharacters, 
  1640 
  1491             aIndexOfFirstUnconvertibleCharacter, isCountDowngrade);
  1641     if (notRestored > 0)
  1492     
  1642         {
       
  1643         aNumberOfUnconvertibleCharacters += notRestored;
       
  1644         }
       
  1645     else if (notRestored < 0)
       
  1646         {
       
  1647         aNumberOfUnconvertibleCharacters = desLength;
       
  1648         }
       
  1649 
       
  1650     //
       
  1651     // Work out if the string is acceptable as it is (e.g. no unconvertible
       
  1652     // and no downgrades).
       
  1653     //
       
  1654     for (TInt pos = desLength-1;  pos >= 0;  --pos)
       
  1655         {
       
  1656         if (backToUnicodeAfterStd[pos] != aDes[pos])
       
  1657             {
       
  1658             if (backToUnicodeAfterStd[pos] != KReplacementCharacter)
       
  1659                 {
       
  1660                 aNumberOfDowngradedCharacters++;
       
  1661                 }
       
  1662             else
       
  1663                 {
       
  1664                 aNumberOfUnconvertibleCharacters++;
       
  1665                 aIndexOfFirstUnconvertibleCharacter = pos;
       
  1666                 }
       
  1667             }
       
  1668         }
       
  1669 
       
  1670     TInt  totalCharFaultsSoFar = aNumberOfUnconvertibleCharacters + 
  1493     TInt  totalCharFaultsSoFar = aNumberOfUnconvertibleCharacters + 
  1671                                     aNumberOfDowngradedCharacters;
  1494                                     aNumberOfDowngradedCharacters;
  1672     
  1495     
  1673     //
  1496     //
  1674     // If the total unconvertible plus downgrades is zero, then there is nothing
  1497     // If the total unconvertible plus downgrades is zero, then there is nothing
  1698         // Initialise the params...
  1521         // Initialise the params...
  1699         //
  1522         //
  1700         TInt  tmpDowngradedCharacters        = 0;
  1523         TInt  tmpDowngradedCharacters        = 0;
  1701         TInt  tmpUnconvertibleCharacters     = 0;
  1524         TInt  tmpUnconvertibleCharacters     = 0;
  1702         TInt  tmpIndexOfFirstUnconvertibleCharacter = desLength;
  1525         TInt  tmpIndexOfFirstUnconvertibleCharacter = desLength;
  1703 		
  1526         
  1704         //
  1527         ConvertWithAlternativeEncodingL(aDes, backToUnicodeAfterStd, aEncoding,
  1705         // Convert the input string to the alternative encoding...
  1528                 tmpUnconvertibleCharacters, tmpDowngradedCharacters,
  1706         //
  1529                 aNumberRequiringAlternativeEncoding,
  1707         PrepareForConversionFromNativeL(aEncoding);
  1530                 tmpIndexOfFirstUnconvertibleCharacter);       
  1708 
  1531         
  1709         notConverted = iCharacterSetConverter.ConvertFromUnicode(encoded, aDes);
       
  1710         if (notConverted > 0)
       
  1711             {
       
  1712             tmpUnconvertibleCharacters = notConverted;
       
  1713             }
       
  1714         else if (notConverted < 0)
       
  1715             {
       
  1716             tmpUnconvertibleCharacters = desLength;
       
  1717             }
       
  1718 
       
  1719         //
       
  1720         // Convert it back again to the native format...
       
  1721         //
       
  1722         HBufC*  backToUnicodeAfterAltBuf = HBufC::NewLC(desLength);
       
  1723         TPtr  backToUnicodeAfterAlt(backToUnicodeAfterAltBuf->Des());
       
  1724         TInt  state       = CCnvCharacterSetConverter::KStateDefault;
       
  1725         TInt  notRestored = iCharacterSetConverter.ConvertToUnicode(backToUnicodeAfterAlt, encoded, state);
       
  1726 
       
  1727         if (notRestored > 0)
       
  1728             {
       
  1729             tmpUnconvertibleCharacters += notRestored;
       
  1730             }
       
  1731         else if (notRestored < 0)
       
  1732             {
       
  1733             tmpUnconvertibleCharacters = desLength;
       
  1734             }
       
  1735 
       
  1736         //
       
  1737         // Now work out which characters are downgrades, require alternative encoding
       
  1738         // or are unsupported.
       
  1739         //
       
  1740         for (TInt pos = desLength-1;  pos >= 0;  --pos)
       
  1741             {
       
  1742             if (backToUnicodeAfterStd[pos] != aDes[pos])
       
  1743                 {
       
  1744                 // Not supported by standard encoder...
       
  1745                 if (backToUnicodeAfterAlt[pos] == aDes[pos])
       
  1746                     {
       
  1747                     // Supported by alternative encoder...
       
  1748                     aNumberRequiringAlternativeEncoding++;
       
  1749                     }
       
  1750                 else if (backToUnicodeAfterStd[pos] != KReplacementCharacter)
       
  1751                     {
       
  1752                     // Downgraded by standard encoder...
       
  1753                     tmpDowngradedCharacters++;
       
  1754                     }
       
  1755                 else if (backToUnicodeAfterAlt[pos] != KReplacementCharacter)
       
  1756                     {
       
  1757                     // Downgraded by alternative encoder...
       
  1758                     tmpDowngradedCharacters++;
       
  1759                     aNumberRequiringAlternativeEncoding++;
       
  1760                     }
       
  1761                 else
       
  1762                     {
       
  1763                     // Unconvertible...
       
  1764                     tmpUnconvertibleCharacters++;
       
  1765                     tmpIndexOfFirstUnconvertibleCharacter = pos;
       
  1766                     }
       
  1767                 }
       
  1768             }
       
  1769 
       
  1770         // Is this better?  
  1532         // Is this better?  
  1771         if ( totalCharFaultsSoFar >= (tmpUnconvertibleCharacters + tmpDowngradedCharacters) )
  1533         if ( totalCharFaultsSoFar >= (tmpUnconvertibleCharacters + tmpDowngradedCharacters) )
  1772             {
  1534             {
  1773             // Best conversion is the alternative conversion
  1535             // Best conversion is the alternative conversion
  1774             aNumberOfUnconvertibleCharacters     = tmpUnconvertibleCharacters;
  1536             aNumberOfUnconvertibleCharacters     = tmpUnconvertibleCharacters;
  1778         else
  1540         else
  1779             {
  1541             {
  1780             // Best conversion is the standard conversion
  1542             // Best conversion is the standard conversion
  1781             aNumberRequiringAlternativeEncoding = 0;
  1543             aNumberRequiringAlternativeEncoding = 0;
  1782             }
  1544             }
  1783         
       
  1784         CleanupStack::PopAndDestroy(backToUnicodeAfterAltBuf);
       
  1785         }
  1545         }
  1786     
  1546     
  1787     CleanupStack::PopAndDestroy(backToUnicodeAfterStdBuf);
  1547     CleanupStack::PopAndDestroy(backToUnicodeAfterStdBuf);   
  1788     CleanupStack::PopAndDestroy(encodedBuf);
  1548  
  1789 
       
  1790 	//
  1549 	//
  1791 	// Useful logging...
  1550 	// Useful logging...
  1792 	//
  1551 	//
  1793 	TBool  supported = (aNumberOfUnconvertibleCharacters == 0);
  1552 	TBool  supported = (aNumberOfUnconvertibleCharacters == 0);
  1794 
  1553 
  1795 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL3_2, "CSmsAlphabetConverter::IsSupportedL(): aNumberOfUnconvertibleCharacters=%d.", aNumberOfUnconvertibleCharacters);
  1554 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_2, "CSmsAlphabetConverter::IsSupportedL(): aNumberOfUnconvertibleCharacters=%d.", aNumberOfUnconvertibleCharacters);
  1796 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL3_3, "CSmsAlphabetConverter::IsSupportedL(): aNumberOfDowngradedCharacters=%d.", aNumberOfDowngradedCharacters);
  1555 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_3, "CSmsAlphabetConverter::IsSupportedL(): aNumberOfDowngradedCharacters=%d.", aNumberOfDowngradedCharacters);
  1797 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL3_4, "CSmsAlphabetConverter::IsSupportedL(): aNumberRequiringAlternativeEncoding=%d.", aNumberRequiringAlternativeEncoding);
  1556 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_4, "CSmsAlphabetConverter::IsSupportedL(): aNumberRequiringAlternativeEncoding=%d.", aNumberRequiringAlternativeEncoding);
  1798 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL3_5, "CSmsAlphabetConverter::IsSupportedL(): aIndexOfFirstUnconvertibleCharacter=%d.", aIndexOfFirstUnconvertibleCharacter);
  1557 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_5, "CSmsAlphabetConverter::IsSupportedL(): aIndexOfFirstUnconvertibleCharacter=%d.", aIndexOfFirstUnconvertibleCharacter);
  1799 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL3_6, "CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
  1558 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_ISSUPPORTEDL1_6, "CSmsAlphabetConverter::IsSupportedL(): supported=%d.", supported);
  1800 
  1559 
  1801 	return supported;
  1560 	return supported;
  1802 	} // CSmsAlphabetConverter::IsSupportedL
  1561 	} // CSmsAlphabetConverter::IsSupportedL
  1803 
  1562 
       
  1563 
       
  1564 /**
       
  1565  *  Tests if the descriptor text is supported by the current character set.
       
  1566  * 
       
  1567  *  @param aDes                                 Text string to check.
       
  1568  *  @param aRestoredDes                         Exit restored text string after conversion.
       
  1569  *  @param aNumberOfUnconvertibleCharacters     Exit param for the number of
       
  1570  *                                              characters unconvertible.
       
  1571  *  @param aNumberOfDowngradedCharacters        Exit param for the number of
       
  1572  *                                              downgraded characters.
       
  1573  *  @param aIndexOfFirstUnconvertibleCharacter  Exit param for the first
       
  1574  *                                              unconverted character.
       
  1575  *  @param aIsCountDowngrade                    Flag for counting downgrades.
       
  1576  */
       
  1577 void CSmsAlphabetConverter::ConvertWith7BitEncodingL(const TDesC& aDes, TDes& aRestoredDes,
       
  1578                                           TInt& aNumberOfUnconvertibleCharacters,
       
  1579                                           TInt& aNumberOfDowngradedCharacters,
       
  1580                                           TInt& aIndexOfFirstUnconvertibleCharacter,
       
  1581                                           TBool aIsCountDowngrade)
       
  1582     {
       
  1583  	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_CONVERTWITH7BITENCODINGL_1, "CSmsAlphabetConverter::ConvertWith7BitEncodingL(aDes=\"%S\")", aDes);
       
  1584 
       
  1585     TInt desLength = aDes.Length();
       
  1586     //
       
  1587     // Initialise the exit params...
       
  1588     //
       
  1589     aNumberOfUnconvertibleCharacters    = 0;
       
  1590     aNumberOfDowngradedCharacters       = 0;
       
  1591     aIndexOfFirstUnconvertibleCharacter = desLength;
       
  1592     
       
  1593     //
       
  1594     // Create buffer for the input converted to 7Bit.
       
  1595     //
       
  1596     HBufC8* encodedBuf       = HBufC8::NewLC(desLength*2); // worse case
       
  1597     TPtr8  encoded(encodedBuf->Des());
       
  1598 
       
  1599     //
       
  1600     // Convert the input string to standard 7bit (with downgrades if needed)...
       
  1601     // 
       
  1602     PrepareForConversionFromNativeL(ESmsEncodingNone);
       
  1603 
       
  1604     TInt  notConverted = iCharacterSetConverter.ConvertFromUnicode(encoded, aDes);
       
  1605 
       
  1606     if (notConverted > 0)
       
  1607         {
       
  1608         aNumberOfUnconvertibleCharacters += notConverted;
       
  1609         }
       
  1610     else if (notConverted < 0)
       
  1611         {
       
  1612         aNumberOfUnconvertibleCharacters = desLength;
       
  1613         }
       
  1614     
       
  1615     //
       
  1616     // Convert it back again to the native format...
       
  1617     //
       
  1618     TInt  state       = CCnvCharacterSetConverter::KStateDefault;
       
  1619     TInt  notRestored = iCharacterSetConverter.ConvertToUnicode(aRestoredDes, encoded, state);
       
  1620 
       
  1621     if (notRestored > 0)
       
  1622         {
       
  1623         aNumberOfUnconvertibleCharacters += notRestored;
       
  1624         }
       
  1625     else if (notRestored < 0)
       
  1626         {
       
  1627         aNumberOfUnconvertibleCharacters = desLength;
       
  1628         }
       
  1629 
       
  1630     //
       
  1631     // Work out if the string is acceptable as it is (e.g. no unconvertible
       
  1632     // and no downgrades).
       
  1633     //
       
  1634     for (TInt pos = desLength-1;  pos >= 0;  --pos)
       
  1635         {
       
  1636         if (aRestoredDes[pos] != aDes[pos])
       
  1637             {
       
  1638             if (aRestoredDes[pos] != KReplacementCharacter
       
  1639                     && aIsCountDowngrade)
       
  1640                 {
       
  1641                 ++aNumberOfDowngradedCharacters;
       
  1642                 }
       
  1643             else
       
  1644                 {
       
  1645                 ++aNumberOfUnconvertibleCharacters;
       
  1646                 aIndexOfFirstUnconvertibleCharacter = pos;
       
  1647                 }
       
  1648             }
       
  1649         }
       
  1650     
       
  1651     CleanupStack::PopAndDestroy(encodedBuf);
       
  1652     
       
  1653 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_CONVERTWITH7BITENCODINGL_2, "CSmsAlphabetConverter::ConvertWith7BitEncodingL(): aNumberOfUnconvertibleCharacters=%d.", aNumberOfUnconvertibleCharacters);
       
  1654 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_CONVERTWITH7BITENCODINGL_3, "CSmsAlphabetConverter::ConvertWith7BitEncodingL(): aNumberOfDowngradedCharacters=%d.", aNumberOfDowngradedCharacters);
       
  1655 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_CONVERTWITH7BITENCODINGL_4, "CSmsAlphabetConverter::ConvertWith7BitEncodingL(): aIndexOfFirstUnconvertibleCharacter=%d.", aIndexOfFirstUnconvertibleCharacter);
       
  1656     } // CSmsAlphabetConverter::ConvertWith7BitEncodingL    
       
  1657 
       
  1658 /**
       
  1659  *  Tests if the descriptor text is supported by given encoding.
       
  1660  *  This function can be used with 7bit and 8bit alphabets.
       
  1661  * 
       
  1662  *  @param aDes                                 Text string to check.
       
  1663  *  @param aRestoredStdDes                      Text string restored from 7bit encoding.
       
  1664  *  @param aEncoding                            Alternative 7bit encoding.
       
  1665  *  @param aNumberOfUnconvertibleCharacters     Exit param for the number of
       
  1666  *                                              characters unconvertible.
       
  1667  *  @param aNumberOfDowngradedCharacters        Exit param for the number of
       
  1668  *                                              downgraded characters.
       
  1669  *  @param aNumberRequiringAlternativeEncoding  Exit param for the number of
       
  1670  *                                              characters requiring use of
       
  1671  *                                              the alternative encoder.
       
  1672  *  @param aIndexOfFirstUnconvertibleCharacter  Exit param for the first
       
  1673  */
       
  1674 void CSmsAlphabetConverter::ConvertWithAlternativeEncodingL(const TDesC& aDes, const TDesC& aRestoredStdDes, 
       
  1675                                           TSmsEncoding aEncoding,
       
  1676                                           TInt& aNumberOfUnconvertibleCharacters,
       
  1677                                           TInt& aNumberOfDowngradedCharacters,
       
  1678                                           TInt& aNumberRequiringAlternativeEncoding,
       
  1679                                           TInt& aIndexOfFirstUnconvertibleCharacter)
       
  1680     {
       
  1681   	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_CONVERTWITHALTERNATIVEEENCODINGL_1, "CSmsAlphabetConverter::ConvertWithAlternativeEncodingL(aDes=\"%S\")", aDes);
       
  1682   
       
  1683     TInt desLength = aDes.Length();
       
  1684     //
       
  1685     // Initialise the exit params...
       
  1686     //
       
  1687     aNumberOfUnconvertibleCharacters    = 0;
       
  1688     aNumberOfDowngradedCharacters       = 0;
       
  1689     aNumberRequiringAlternativeEncoding = 0;
       
  1690     aIndexOfFirstUnconvertibleCharacter = desLength;
       
  1691         
       
  1692     //
       
  1693     // Create buffer for the input converted to 7Bit.
       
  1694     //
       
  1695     HBufC8* encodedBuf = HBufC8::NewLC(desLength*2); // worse case
       
  1696     TPtr8  encoded(encodedBuf->Des());
       
  1697  
       
  1698     //
       
  1699     // Convert the input string to the alternative encoding...
       
  1700     //
       
  1701     PrepareForConversionFromNativeL(aEncoding);
       
  1702 
       
  1703     TInt notConverted = iCharacterSetConverter.ConvertFromUnicode(encoded, aDes);
       
  1704     if (notConverted > 0)
       
  1705         {
       
  1706         aNumberOfUnconvertibleCharacters = notConverted;
       
  1707         }
       
  1708     else if (notConverted < 0)
       
  1709         {
       
  1710         aNumberOfUnconvertibleCharacters = desLength;
       
  1711         }
       
  1712 
       
  1713     //
       
  1714     // Create buffer for restored text...
       
  1715     //
       
  1716     HBufC*  backToUnicodeBuf = HBufC::NewLC(desLength);
       
  1717     TPtr  backToUnicode(backToUnicodeBuf->Des());
       
  1718 
       
  1719     //
       
  1720     // Convert it back again to the native format...
       
  1721     //
       
  1722     TInt  state       = CCnvCharacterSetConverter::KStateDefault;
       
  1723     TInt  notRestored = iCharacterSetConverter.ConvertToUnicode(backToUnicode, encoded, state);
       
  1724 
       
  1725     if (notRestored > 0)
       
  1726         {
       
  1727         aNumberOfUnconvertibleCharacters += notRestored;
       
  1728         }
       
  1729     else if (notRestored < 0)
       
  1730         {
       
  1731         aNumberOfUnconvertibleCharacters = desLength;
       
  1732         }
       
  1733 
       
  1734     //
       
  1735     // Now work out which characters are downgrades, require alternative encoding
       
  1736     // or are unsupported.
       
  1737     //
       
  1738     for (TInt pos = desLength-1;  pos >= 0;  --pos)
       
  1739         {
       
  1740         if (aRestoredStdDes[pos] != aDes[pos])
       
  1741             {
       
  1742             // Not supported by standard encoder...
       
  1743             if (backToUnicode[pos] == aDes[pos])
       
  1744                 {
       
  1745                 // Supported by alternative encoder...
       
  1746                 ++aNumberRequiringAlternativeEncoding;
       
  1747                 }
       
  1748             else if (aRestoredStdDes[pos] != KReplacementCharacter)
       
  1749                 {
       
  1750                 // Downgraded by standard encoder...
       
  1751                 ++aNumberOfDowngradedCharacters;
       
  1752                 }
       
  1753             else if (backToUnicode[pos] != KReplacementCharacter)
       
  1754                 {
       
  1755                 // Downgraded by alternative encoder...
       
  1756                 ++aNumberOfDowngradedCharacters;
       
  1757                 ++aNumberRequiringAlternativeEncoding;
       
  1758                 }
       
  1759             else
       
  1760                 {
       
  1761                 // Unconvertible...
       
  1762                 ++aNumberOfUnconvertibleCharacters;
       
  1763                 aIndexOfFirstUnconvertibleCharacter = pos;
       
  1764                 }
       
  1765             }
       
  1766         }
       
  1767 
       
  1768     CleanupStack::PopAndDestroy(2, encodedBuf); // backToUnicode, encodedBuf
       
  1769     
       
  1770  	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_CONVERTWITHALTERNATIVEEENCODINGL_2, "CSmsAlphabetConverter::ConvertWithAlternativeEncodingL(): aNumberOfUnconvertibleCharacters=%d.", aNumberOfUnconvertibleCharacters);
       
  1771 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_CONVERTWITHALTERNATIVEEENCODINGL_3, "CSmsAlphabetConverter::ConvertWithAlternativeEncodingL(): aNumberOfDowngradedCharacters=%d.", aNumberOfDowngradedCharacters);
       
  1772 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_CONVERTWITHALTERNATIVEEENCODINGL_4, "CSmsAlphabetConverter::ConvertWithAlternativeEncodingL(): aNumberRequiringAlternativeEncoding=%d.", aNumberRequiringAlternativeEncoding);
       
  1773 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_CONVERTWITHALTERNATIVEEENCODINGL_5, "CSmsAlphabetConverter::ConvertWithAlternativeEncodingL(): aIndexOfFirstUnconvertibleCharacter=%d.", aIndexOfFirstUnconvertibleCharacter);
       
  1774     } // CSmsAlphabetConverter::ConvertWithAlternativeEncodingL    
  1804 
  1775 
  1805 /**
  1776 /**
  1806  *  Given a piece of text and an alternative encoding, this function works out
  1777  *  Given a piece of text and an alternative encoding, this function works out
  1807  *  which encoding is best to use and returns the ID of that converter.
  1778  *  which encoding is best to use and returns the ID of that converter.
  1808  * 
  1779  * 
  1823 	// nothing...
  1794 	// nothing...
  1824 	//
  1795 	//
  1825 	if (aSuggestedEncoding != ESmsEncodingNone  &&
  1796 	if (aSuggestedEncoding != ESmsEncodingNone  &&
  1826 		iSmsAlphabet == TSmsDataCodingScheme::ESmsAlphabet7Bit)
  1797 		iSmsAlphabet == TSmsDataCodingScheme::ESmsAlphabet7Bit)
  1827 		{
  1798 		{
       
  1799         TInt desLength = aNativeCharacters.Length();
  1828 		TInt  numberOfUnconvertibleCharacters, numberOfDowngradedCharacters;
  1800 		TInt  numberOfUnconvertibleCharacters, numberOfDowngradedCharacters;
  1829 		TInt  numberRequiringAlternativeEncoding, indexOfFirstUnconvertibleCharacter;
  1801 		TInt  numberRequiringAlternativeEncoding, indexOfFirstUnconvertibleCharacter;
  1830 		
  1802 		
  1831 		//
  1803 		//
  1832 		// First try the default encoding (but in this case treat downgrades
  1804 		// First try the default encoding (but in this case treat downgrades
  1833 		// as unconverted, since later encoders might do better)...
  1805 		// as unconverted, since later encoders might do better)...
  1834 		//
  1806 		//
  1835 		IsSupportedL(aNativeCharacters, ESmsEncodingNone,
  1807 		HBufC*  backToUnicodeAfterStdBuf = HBufC::NewLC(desLength);
  1836 					 numberOfUnconvertibleCharacters,
  1808 	    TPtr  backToUnicodeAfterStd(backToUnicodeAfterStdBuf->Des());
  1837                      numberOfDowngradedCharacters,
  1809 	    TBool  isCountDowngrade = ETrue; // Count downgraded chars
  1838                      numberRequiringAlternativeEncoding,
  1810 		
  1839                      indexOfFirstUnconvertibleCharacter);
  1811 	    ConvertWith7BitEncodingL(aNativeCharacters, backToUnicodeAfterStd, 
       
  1812 	            numberOfUnconvertibleCharacters, numberOfDowngradedCharacters, 
       
  1813 	            indexOfFirstUnconvertibleCharacter, isCountDowngrade);
       
  1814 		
  1840 
  1815 
  1841 		TInt leastUnconvertibleCharacters = numberOfUnconvertibleCharacters + numberOfDowngradedCharacters;
  1816 		TInt leastUnconvertibleCharacters = numberOfUnconvertibleCharacters + numberOfDowngradedCharacters;
  1842 
  1817 
  1843 		//
  1818 		if (leastUnconvertibleCharacters > 0)
  1844 		// Create a list of alternative encodings to try...
  1819 		    {
  1845 		//
  1820             //
  1846 		TSmsEncoding  encodingList[8];
  1821             // Create a list of alternative encodings to try...
  1847 		TInt          encodingCount = 0;
  1822             //
       
  1823             TSmsEncoding  encodingList[8];
       
  1824             TInt          encodingCount = 0;
       
  1825             
       
  1826             if (aSuggestedEncoding == ESmsEncodingTurkishLockingAndSingleShift)
       
  1827                 {
       
  1828                 encodingList[encodingCount++] = ESmsEncodingTurkishSingleShift;
       
  1829                 encodingList[encodingCount++] = ESmsEncodingTurkishLockingShift;
       
  1830                 }
       
  1831             else if (aSuggestedEncoding == ESmsEncodingPortugueseLockingAndSingleShift)
       
  1832                 {
       
  1833                 encodingList[encodingCount++] = ESmsEncodingPortugueseSingleShift;
       
  1834                 encodingList[encodingCount++] = ESmsEncodingPortugueseLockingShift;
       
  1835                 }
       
  1836             
       
  1837             encodingList[encodingCount++] = aSuggestedEncoding;
       
  1838 
       
  1839             //
       
  1840             // Now try the all the alternatives...
       
  1841             //
       
  1842             for (TInt  encoder = 0;  encoder < encodingCount && leastUnconvertibleCharacters > 0;  ++encoder)
       
  1843                 {
       
  1844                 ConvertWithAlternativeEncodingL(aNativeCharacters, backToUnicodeAfterStd, 
       
  1845                         encodingList[encoder], 
       
  1846                         numberOfUnconvertibleCharacters, 
       
  1847                         numberOfDowngradedCharacters,
       
  1848                         numberRequiringAlternativeEncoding,
       
  1849                         indexOfFirstUnconvertibleCharacter);       
       
  1850 
       
  1851                 if (numberOfUnconvertibleCharacters + numberOfDowngradedCharacters < leastUnconvertibleCharacters)
       
  1852                     {
       
  1853                     encodingToUse = encodingList[encoder];
       
  1854                     leastUnconvertibleCharacters = numberOfUnconvertibleCharacters + numberOfDowngradedCharacters;
       
  1855                     }
       
  1856                 }
       
  1857 		    }
  1848 		
  1858 		
  1849 		if (aSuggestedEncoding == ESmsEncodingTurkishLockingAndSingleShift)
  1859             CleanupStack::PopAndDestroy(backToUnicodeAfterStdBuf);
  1850 			{
       
  1851 			encodingList[encodingCount++] = ESmsEncodingTurkishSingleShift;
       
  1852 			encodingList[encodingCount++] = ESmsEncodingTurkishLockingShift;
       
  1853 			}
       
  1854 		else if (aSuggestedEncoding == ESmsEncodingPortugueseLockingAndSingleShift)
       
  1855 			{
       
  1856 			encodingList[encodingCount++] = ESmsEncodingPortugueseSingleShift;
       
  1857 			encodingList[encodingCount++] = ESmsEncodingPortugueseLockingShift;
       
  1858 			}
       
  1859 
       
  1860 		encodingList[encodingCount++] = aSuggestedEncoding;
       
  1861 		encodingList[encodingCount++] = ESmsEncodingNone;
       
  1862 
       
  1863 		//
       
  1864 		// Now try the all the alternatives...
       
  1865 		//
       
  1866 		for (TInt  encoder = 0;  encoder < encodingCount;  encoder++)
       
  1867 			{
       
  1868 			IsSupportedL(aNativeCharacters, encodingList[encoder],
       
  1869 						 numberOfUnconvertibleCharacters,
       
  1870 	                     numberOfDowngradedCharacters,
       
  1871 	                     numberRequiringAlternativeEncoding,
       
  1872 	                     indexOfFirstUnconvertibleCharacter);
       
  1873 			if (numberOfUnconvertibleCharacters + numberOfDowngradedCharacters < leastUnconvertibleCharacters)
       
  1874 				{
       
  1875 				encodingToUse = encodingList[encoder];
       
  1876 				leastUnconvertibleCharacters = numberOfUnconvertibleCharacters + numberOfDowngradedCharacters;
       
  1877 				}
       
  1878 			}
       
  1879 		}
  1860 		}
  1880 
  1861 
  1881 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_FINDBESTALTERNATIVEENCODINGL_2, "CSmsAlphabetConverter::FindBestAlternativeEncodingL(): encodingToUse=%d", encodingToUse);
  1862 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSALPHABETCONVERTER_FINDBESTALTERNATIVEENCODINGL_2, "CSmsAlphabetConverter::FindBestAlternativeEncodingL(): encodingToUse=%d", encodingToUse);
  1882 
  1863 
  1883 	return encodingToUse;
  1864 	return encodingToUse;
  3965  */
  3946  */
  3966 EXPORT_C TBool CSmsUserData::IsSupportedL(TChar aChar)
  3947 EXPORT_C TBool CSmsUserData::IsSupportedL(TChar aChar)
  3967 	{
  3948 	{
  3968 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSUSERDATA_ISSUPPORTEDL_1, "CSmsUserData::IsSupportedL()");
  3949 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSUSERDATA_ISSUPPORTEDL_1, "CSmsUserData::IsSupportedL()");
  3969 
  3950 
       
  3951 	TInt  numberOfUnconvertibleCharacters, numberOfDowngradedCharacters, 
       
  3952 	           numberRequiringAlternativeEncoding, indexOfFirstUnconvertibleCharacter;	
       
  3953 	TBuf<4>   toEncode;
       
  3954     toEncode.SetLength(1);
       
  3955     toEncode[0]=(TText)aChar;
       
  3956 
  3970 	CSmsAlphabetConverter* converter=CSmsAlphabetConverter::NewLC(iCharacterSetConverter,iFs,iDataCodingScheme.Alphabet(),IsBinaryData());
  3957 	CSmsAlphabetConverter* converter=CSmsAlphabetConverter::NewLC(iCharacterSetConverter,iFs,iDataCodingScheme.Alphabet(),IsBinaryData());
  3971 	TBool result=converter->IsSupportedL(aChar);
  3958 	TBool result=converter->IsSupportedL(toEncode, ESmsEncodingNone, 
  3972 	CleanupStack::PopAndDestroy();
  3959                                          numberOfUnconvertibleCharacters,
       
  3960                                          numberOfDowngradedCharacters,
       
  3961                                          numberRequiringAlternativeEncoding,
       
  3962                                          indexOfFirstUnconvertibleCharacter);	
       
  3963 	CleanupStack::PopAndDestroy(converter);
  3973 
  3964 
  3974 	return result;
  3965 	return result;
  3975 	} // CSmsUserData::IsSupportedL
  3966 	} // CSmsUserData::IsSupportedL
  3976 
  3967 
  3977 
  3968