os/textandloc/charconvfw/charconvplugins/src/plugins/ISO2022JP_2.CPP
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/charconvfw/charconvplugins/src/plugins/ISO2022JP_2.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,410 @@
     1.4 +/*
     1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:       
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#include "PictographObserver.h"
    1.22 +#include "featmgr/featmgr.h" 
    1.23 +
    1.24 +#include <e32std.h>
    1.25 +#include <charconv.h>
    1.26 +#include <convutils.h>
    1.27 +#include "jisbase.h"
    1.28 +#include "jisx0201.h"
    1.29 +#include "jisx0208.h"
    1.30 +#include <ecom/implementationproxy.h>
    1.31 +#include "charactersetconverter.h"
    1.32 +
    1.33 +
    1.34 +_LIT8(KLit8EscapeSequenceForJisRoman, "\x1b\x28\x4a");
    1.35 +_LIT8(KLit8EscapeSequenceForAscii, "\x1b\x28\x42");     
    1.36 +_LIT8(KLit8EscapeSequenceForJisX0208_1983, "\x1b\x24\x42");
    1.37 +//_LIT8(KLit8EscapeSequenceForJisC6226_1978, "\x1b\x24\x40");
    1.38 +//_LIT8(KLit8EscapeSequenceForJisX0212_1990, "\x1b\x24\x28\x44"); 
    1.39 +//_LIT8(KLit8EscapeSequenceForHalfWidthKatakana, "\x1b\x28\x49");
    1.40 +_LIT8(KLit8Iso2022JpReplacementForUnconvertibleUnicodeCharacters, "\x1b\x24\x42\x21\x29"); // fullwidth question mark
    1.41 +
    1.42 +
    1.43 +class CISO2022JPConverterImpl : public CCharacterSetConverterPluginInterface
    1.44 +    {
    1.45 +
    1.46 +public:
    1.47 +    virtual const TDesC8& ReplacementForUnconvertibleUnicodeCharacters();
    1.48 +
    1.49 +    virtual TInt ConvertFromUnicode(
    1.50 +        CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
    1.51 +        const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, 
    1.52 +        TDes8& aForeign, 
    1.53 +        const TDesC16& aUnicode, 
    1.54 +        CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters);
    1.55 +
    1.56 +    virtual TInt ConvertToUnicode(
    1.57 +        CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
    1.58 +        TDes16& aUnicode, 
    1.59 +        const TDesC8& aForeign, 
    1.60 +        TInt& aState, 
    1.61 +        TInt& aNumberOfUnconvertibleCharacters, 
    1.62 +        TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
    1.63 +
    1.64 +    virtual TBool IsInThisCharacterSetL(
    1.65 +        TBool& aSetToTrue, 
    1.66 +        TInt& aConfidenceLevel, 
    1.67 +        const TDesC8& aSample);
    1.68 +
    1.69 +    static CISO2022JPConverterImpl* NewL();
    1.70 +    virtual ~CISO2022JPConverterImpl();
    1.71 +
    1.72 +private:
    1.73 +    CISO2022JPConverterImpl();
    1.74 +    void ConstructL();
    1.75 +
    1.76 +    };
    1.77 +
    1.78 +
    1.79 +
    1.80 +const TDesC8& CISO2022JPConverterImpl::ReplacementForUnconvertibleUnicodeCharacters()
    1.81 +    {
    1.82 +    return KLit8Iso2022JpReplacementForUnconvertibleUnicodeCharacters;
    1.83 +    }
    1.84 +
    1.85 +LOCAL_C void ConvertFromJisRomanToJisInPlace(TInt aStartPositionInDescriptor, TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut)
    1.86 +    {
    1.87 +    CnvUtilities::ConvertFromIntermediateBufferInPlace(aStartPositionInDescriptor, aDescriptor, aNumberOfCharactersThatDroppedOut, KLit8EscapeSequenceForJisRoman, 1);
    1.88 +    }
    1.89 +
    1.90 +LOCAL_C void ConvertFromAsciiToJisInPlace(TInt aStartPositionInDescriptor, TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut)
    1.91 +    {
    1.92 +    CnvUtilities::ConvertFromIntermediateBufferInPlace(aStartPositionInDescriptor, aDescriptor, aNumberOfCharactersThatDroppedOut, KLit8EscapeSequenceForAscii, 1);
    1.93 +    }
    1.94 +
    1.95 +LOCAL_C void ConvertFromJisX0208ToJisInPlace(TInt aStartPositionInDescriptor, TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut)
    1.96 +    {
    1.97 +    CnvUtilities::ConvertFromIntermediateBufferInPlace(aStartPositionInDescriptor, aDescriptor, aNumberOfCharactersThatDroppedOut, KLit8EscapeSequenceForJisX0208_1983, 2);
    1.98 +    }
    1.99 +
   1.100 +struct TConvTblFromHalfKanaToFullKana
   1.101 +    {
   1.102 +    TUint8  iHalfKana;
   1.103 +    TUint8  iHalfKanaMark;
   1.104 +    TUint16 iFullKana;
   1.105 +    };
   1.106 +
   1.107 +LOCAL_D const TConvTblFromHalfKanaToFullKana convTblFromHalfKanaToFullKana[]=
   1.108 +    {
   1.109 +        { 0xA1, 0x00, 0x2123 },     // IDEOGRAPHIC FULL STOP
   1.110 +        { 0xA2, 0x00, 0x2156 },     // LEFT CORNER BRACKET
   1.111 +        { 0xA3, 0x00, 0x2157 },     // RIGHT CORNER BRACKET
   1.112 +        { 0xA4, 0x00, 0x2122 },     // IDEOGRAPHIC COMMA
   1.113 +        { 0xA5, 0x00, 0x2126 },     // KATAKANA MIDDLE DOT
   1.114 +        { 0xA6, 0x00, 0x2572 },     // KATAKANA LETTER WO
   1.115 +        { 0xA7, 0x00, 0x2521 },     // KATAKANA LETTER SMALL A
   1.116 +        { 0xA8, 0x00, 0x2523 },     // KATAKANA LETTER SMALL I
   1.117 +        { 0xA9, 0x00, 0x2525 },     // KATAKANA LETTER SMALL U
   1.118 +        { 0xAA, 0x00, 0x2527 },     // KATAKANA LETTER SMALL E
   1.119 +        { 0xAB, 0x00, 0x2529 },     // KATAKANA LETTER SMALL O
   1.120 +        { 0xAC, 0x00, 0x2563 },     // KATAKANA LETTER SMALL YA
   1.121 +        { 0xAD, 0x00, 0x2565 },     // KATAKANA LETTER SMALL YU
   1.122 +        { 0xAE, 0x00, 0x2567 },     // KATAKANA LETTER SMALL YO
   1.123 +        { 0xAF, 0x00, 0x2543 },     // KATAKANA LETTER SMALL TU
   1.124 +        { 0xB0, 0x00, 0x213C },     // KATAKANA-HIRAGANA PROLONGED SOUND MARK
   1.125 +        { 0xB1, 0x00, 0x2522 },     // KATAKANA LETTER A
   1.126 +        { 0xB2, 0x00, 0x2524 },     // KATAKANA LETTER I
   1.127 +        { 0xB3, 0x00, 0x2526 },     // KATAKANA LETTER U
   1.128 +        { 0xB3, 0xDE, 0x2574 },     // KATAKANA LETTER VU
   1.129 +        { 0xB4, 0x00, 0x2528 },     // KATAKANA LETTER E
   1.130 +        { 0xB5, 0x00, 0x252A },     // KATAKANA LETTER O
   1.131 +        { 0xB6, 0x00, 0x252B },     // KATAKANA LETTER KA
   1.132 +        { 0xB6, 0xDE, 0x252C },     // KATAKANA LETTER GA
   1.133 +        { 0xB7, 0x00, 0x252D },     // KATAKANA LETTER KI
   1.134 +        { 0xB7, 0xDE, 0x252E },     // KATAKANA LETTER GI
   1.135 +        { 0xB8, 0x00, 0x252F },     // KATAKANA LETTER KU
   1.136 +        { 0xB8, 0xDE, 0x2530 },     // KATAKANA LETTER GU
   1.137 +        { 0xB9, 0x00, 0x2531 },     // KATAKANA LETTER KE
   1.138 +        { 0xB9, 0xDE, 0x2532 },     // KATAKANA LETTER GE
   1.139 +        { 0xBA, 0x00, 0x2533 },     // KATAKANA LETTER KO
   1.140 +        { 0xBA, 0xDE, 0x2534 },     // KATAKANA LETTER GO
   1.141 +        { 0xBB, 0x00, 0x2535 },     // KATAKANA LETTER SA
   1.142 +        { 0xBB, 0xDE, 0x2536 },     // KATAKANA LETTER ZA
   1.143 +        { 0xBC, 0x00, 0x2537 },     // KATAKANA LETTER SI
   1.144 +        { 0xBC, 0xDE, 0x2538 },     // KATAKANA LETTER ZI
   1.145 +        { 0xBD, 0x00, 0x2539 },     // KATAKANA LETTER SU
   1.146 +        { 0xBD, 0xDE, 0x253A },     // KATAKANA LETTER ZU
   1.147 +        { 0xBE, 0x00, 0x253B },     // KATAKANA LETTER SE
   1.148 +        { 0xBE, 0xDE, 0x253C },     // KATAKANA LETTER ZE
   1.149 +        { 0xBF, 0x00, 0x253D },     // KATAKANA LETTER SO
   1.150 +        { 0xBF, 0xDE, 0x253E },     // KATAKANA LETTER ZO
   1.151 +        { 0xC0, 0x00, 0x253F },     // KATAKANA LETTER TA
   1.152 +        { 0xC0, 0xDE, 0x2540 },     // KATAKANA LETTER DA
   1.153 +        { 0xC1, 0x00, 0x2541 },     // KATAKANA LETTER TI
   1.154 +        { 0xC1, 0xDE, 0x2542 },     // KATAKANA LETTER DI
   1.155 +        { 0xC2, 0x00, 0x2544 },     // KATAKANA LETTER TU
   1.156 +        { 0xC2, 0xDE, 0x2545 },     // KATAKANA LETTER DU
   1.157 +        { 0xC3, 0x00, 0x2546 },     // KATAKANA LETTER TE
   1.158 +        { 0xC3, 0xDE, 0x2547 },     // KATAKANA LETTER DE
   1.159 +        { 0xC4, 0x00, 0x2548 },     // KATAKANA LETTER TO
   1.160 +        { 0xC4, 0xDE, 0x2549 },     // KATAKANA LETTER DO
   1.161 +        { 0xC5, 0x00, 0x254A },     // KATAKANA LETTER NA
   1.162 +        { 0xC6, 0x00, 0x254B },     // KATAKANA LETTER NI
   1.163 +        { 0xC7, 0x00, 0x254C },     // KATAKANA LETTER NU
   1.164 +        { 0xC8, 0x00, 0x254D },     // KATAKANA LETTER NE
   1.165 +        { 0xC9, 0x00, 0x254E },     // KATAKANA LETTER NO
   1.166 +        { 0xCA, 0x00, 0x254F },     // KATAKANA LETTER HA
   1.167 +        { 0xCA, 0xDE, 0x2550 },     // KATAKANA LETTER BA
   1.168 +        { 0xCA, 0xDF, 0x2551 },     // KATAKANA LETTER PA
   1.169 +        { 0xCB, 0x00, 0x2552 },     // KATAKANA LETTER HI
   1.170 +        { 0xCB, 0xDE, 0x2553 },     // KATAKANA LETTER BI
   1.171 +        { 0xCB, 0xDF, 0x2554 },     // KATAKANA LETTER PI
   1.172 +        { 0xCC, 0x00, 0x2555 },     // KATAKANA LETTER HU
   1.173 +        { 0xCC, 0xDE, 0x2556 },     // KATAKANA LETTER BU
   1.174 +        { 0xCC, 0xDF, 0x2557 },     // KATAKANA LETTER PU
   1.175 +        { 0xCD, 0x00, 0x2558 },     // KATAKANA LETTER HE
   1.176 +        { 0xCD, 0xDE, 0x2559 },     // KATAKANA LETTER BE
   1.177 +        { 0xCD, 0xDF, 0x255A },     // KATAKANA LETTER PE
   1.178 +        { 0xCE, 0x00, 0x255B },     // KATAKANA LETTER HO
   1.179 +        { 0xCE, 0xDE, 0x255C },     // KATAKANA LETTER BO
   1.180 +        { 0xCE, 0xDF, 0x255D },     // KATAKANA LETTER PO
   1.181 +        { 0xCF, 0x00, 0x255E },     // KATAKANA LETTER MA
   1.182 +        { 0xD0, 0x00, 0x255F },     // KATAKANA LETTER MI
   1.183 +        { 0xD1, 0x00, 0x2560 },     // KATAKANA LETTER MU
   1.184 +        { 0xD2, 0x00, 0x2561 },     // KATAKANA LETTER ME
   1.185 +        { 0xD3, 0x00, 0x2562 },     // KATAKANA LETTER MO
   1.186 +        { 0xD4, 0x00, 0x2564 },     // KATAKANA LETTER YA
   1.187 +        { 0xD5, 0x00, 0x2566 },     // KATAKANA LETTER YU
   1.188 +        { 0xD6, 0x00, 0x2568 },     // KATAKANA LETTER YO
   1.189 +        { 0xD7, 0x00, 0x2569 },     // KATAKANA LETTER RA
   1.190 +        { 0xD8, 0x00, 0x256A },     // KATAKANA LETTER RI
   1.191 +        { 0xD9, 0x00, 0x256B },     // KATAKANA LETTER RU
   1.192 +        { 0xDA, 0x00, 0x256C },     // KATAKANA LETTER RE
   1.193 +        { 0xDB, 0x00, 0x256D },     // KATAKANA LETTER RO
   1.194 +        { 0xDC, 0x00, 0x256F },     // KATAKANA LETTER WA
   1.195 +        { 0xDD, 0x00, 0x2573 },     // KATAKANA LETTER N
   1.196 +        { 0xDE, 0x00, 0x212B },     // HALFWIDTH KATAKANA VOICED SOUND MARK
   1.197 +        { 0xDF, 0x00, 0x212C }      // HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK
   1.198 +    };
   1.199 +#define ARRAY_LENGTH(aArray) (sizeof(aArray)/sizeof((aArray)[0]))
   1.200 +
   1.201 +LOCAL_C void ConvertFromHalfKatakanaToFullKatakana(TInt aStartPositionInDescriptor, TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut)
   1.202 +    {
   1.203 +    // half-width Katakana is 1-byte, but full-width Katakana is 2-bytes.
   1.204 +    TInt convertlength = aDescriptor.Length()-aStartPositionInDescriptor;
   1.205 +    TInt numberOfMarkChar = 0;
   1.206 +    HBufC8* hBuf = HBufC8::New(convertlength*2);
   1.207 +    if (hBuf)
   1.208 +        {
   1.209 +        TPtr8 ptr = hBuf->Des();
   1.210 +        for (TInt i=aStartPositionInDescriptor; i < aDescriptor.Length(); i++)
   1.211 +            {
   1.212 +            const TUint8 convchar = (TUint8)(aDescriptor[i]|0x80);
   1.213 +            const TUint8 convnextchar = (TUint8)((aDescriptor.Length() > (i+1))?
   1.214 +                        (aDescriptor[i+1]|0x80) : TUint8(0x00));
   1.215 +            const TConvTblFromHalfKanaToFullKana* curTbl = &(convTblFromHalfKanaToFullKana[0]);
   1.216 +            for (TUint j=0; j < ARRAY_LENGTH(convTblFromHalfKanaToFullKana); curTbl++, j++)
   1.217 +                {
   1.218 +                if (convchar == curTbl->iHalfKana)
   1.219 +                    {
   1.220 +                    for (TInt k=0; (convchar == (curTbl+k)->iHalfKana); k++)
   1.221 +                        {
   1.222 +                        if (convnextchar == (curTbl+k)->iHalfKanaMark)
   1.223 +                            {
   1.224 +                            curTbl += k;
   1.225 +                            if (convnextchar == 0xDE || convnextchar == 0xDF)
   1.226 +                                {
   1.227 +                                i++;
   1.228 +                                numberOfMarkChar++;
   1.229 +                                }
   1.230 +                            break;
   1.231 +                            }
   1.232 +                        }
   1.233 +                    // set to buffer each 8 bit
   1.234 +                    const TUint8 highbit = (TUint8)(curTbl->iFullKana>>8);
   1.235 +                    const TUint8 lowbit = (TUint8)(curTbl->iFullKana|0xff00);
   1.236 +                    ptr.Append(highbit);
   1.237 +                    ptr.Append(lowbit);
   1.238 +                    break;
   1.239 +                    }
   1.240 +                }
   1.241 +            }
   1.242 +        // add ESC code
   1.243 +        CnvUtilities::ConvertFromIntermediateBufferInPlace(
   1.244 +                            aStartPositionInDescriptor, 
   1.245 +                            aDescriptor, aNumberOfCharactersThatDroppedOut, 
   1.246 +                            KLit8EscapeSequenceForJisX0208_1983, 1);
   1.247 +        if (!aNumberOfCharactersThatDroppedOut)
   1.248 +            {
   1.249 +            // delete half-width katakana
   1.250 +            aDescriptor.Delete(aStartPositionInDescriptor 
   1.251 +                                + KLit8EscapeSequenceForJisX0208_1983().Length(),
   1.252 +                               convertlength);
   1.253 +
   1.254 +            TInt freelength = aDescriptor.MaxLength() - aDescriptor.Length();
   1.255 +            TInt copylength = ptr.Length();
   1.256 +            if (copylength > freelength)
   1.257 +                {
   1.258 +                copylength = freelength - (freelength%2);
   1.259 +                }
   1.260 +            if (copylength > 0)
   1.261 +                {
   1.262 +                // not convert, because there is no enough buffer
   1.263 +                aDescriptor.Append(ptr.Ptr(), copylength);
   1.264 +                aNumberOfCharactersThatDroppedOut=(convertlength-numberOfMarkChar) - (copylength/2);
   1.265 +                }
   1.266 +            else
   1.267 +                {
   1.268 +                // not convert, because there is no enough buffer.
   1.269 +                aNumberOfCharactersThatDroppedOut=convertlength;
   1.270 +                aDescriptor.SetLength(aStartPositionInDescriptor);
   1.271 +                }
   1.272 +            }
   1.273 +        delete hBuf;
   1.274 +        }
   1.275 +    else
   1.276 +        {
   1.277 +        // not convert, because there is no heap area.
   1.278 +        aNumberOfCharactersThatDroppedOut=convertlength;
   1.279 +        aDescriptor.SetLength(aStartPositionInDescriptor);
   1.280 +        }
   1.281 +    }
   1.282 +
   1.283 +TInt CISO2022JPConverterImpl::ConvertFromUnicode(
   1.284 +        CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
   1.285 +        const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, 
   1.286 +        TDes8& aForeign, 
   1.287 +        const TDesC16& aUnicode, 
   1.288 +        CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters)
   1.289 +    {
   1.290 +    TInt ret = KErrNone;
   1.291 +    RArray<CnvUtilities::SCharacterSet> characterSets;
   1.292 +    if ( FeatureManager::FeatureSupported(KFeatureIdJapanesePicto) )
   1.293 +        {        
   1.294 +        CnvUtilities::SCharacterSet characterSet;
   1.295 +        characterSet.iConversionData=&CnvJisRoman::ConversionData();
   1.296 +        characterSet.iConvertFromIntermediateBufferInPlace=ConvertFromJisRomanToJisInPlace;
   1.297 +        characterSet.iEscapeSequence=&KLit8EscapeSequenceForJisRoman;
   1.298 +        ret |= characterSets.Append(characterSet);
   1.299 +        characterSet.iConversionData=&CCnvCharacterSetConverter::AsciiConversionData();
   1.300 +        characterSet.iConvertFromIntermediateBufferInPlace=ConvertFromAsciiToJisInPlace;
   1.301 +        characterSet.iEscapeSequence=&KLit8EscapeSequenceForAscii;
   1.302 +        ret |= characterSets.Append(characterSet);
   1.303 +        characterSet.iConversionData=&CnvJisX0208::ConversionData();
   1.304 +        characterSet.iConvertFromIntermediateBufferInPlace=ConvertFromJisX0208ToJisInPlace;
   1.305 +        characterSet.iEscapeSequence=&KLit8EscapeSequenceForJisX0208_1983;
   1.306 +        ret |= characterSets.Append(characterSet);
   1.307 +        characterSet.iEscapeSequence=&KLit8EscapeSequenceForJisX0208_1983;
   1.308 +        characterSet.iConversionData=&CnvJisBase::HalfWidthKatakana7ConversionData();
   1.309 +        characterSet.iConvertFromIntermediateBufferInPlace=ConvertFromHalfKatakanaToFullKatakana;
   1.310 +        ret |= characterSets.Append(characterSet);
   1.311 +
   1.312 +        SetCharacterSetsForPictograph(characterSets);
   1.313 +        }
   1.314 +    else
   1.315 +        {            
   1.316 +        CnvUtilities::SCharacterSet characterSet;
   1.317 +        characterSet.iConversionData=&CCnvCharacterSetConverter::AsciiConversionData();
   1.318 +        characterSet.iConvertFromIntermediateBufferInPlace=ConvertFromAsciiToJisInPlace;
   1.319 +        characterSet.iEscapeSequence=&KLit8EscapeSequenceForAscii;
   1.320 +        ret |= characterSets.Append(characterSet);
   1.321 +        characterSet.iConversionData=&CnvJisRoman::ConversionData();
   1.322 +        characterSet.iConvertFromIntermediateBufferInPlace=ConvertFromJisRomanToJisInPlace;
   1.323 +        characterSet.iEscapeSequence=&KLit8EscapeSequenceForJisRoman;
   1.324 +        ret |= characterSets.Append(characterSet);
   1.325 +        characterSet.iConversionData=&CnvJisX0208::ConversionData();
   1.326 +        characterSet.iConvertFromIntermediateBufferInPlace=ConvertFromJisX0208ToJisInPlace;
   1.327 +        characterSet.iEscapeSequence=&KLit8EscapeSequenceForJisX0208_1983;
   1.328 +        ret |= characterSets.Append(characterSet);
   1.329 +        characterSet.iEscapeSequence=&KLit8EscapeSequenceForJisX0208_1983;
   1.330 +        characterSet.iConversionData=&CnvJisBase::HalfWidthKatakana7ConversionData();
   1.331 +        characterSet.iConvertFromIntermediateBufferInPlace=ConvertFromHalfKatakanaToFullKatakana;
   1.332 +        ret |= characterSets.Append(characterSet);
   1.333 +        }
   1.334 +    __ASSERT_DEBUG(!ret, User::Panic(_L("RArray append failure"), ret));
   1.335 +    TUint notUsed;
   1.336 +//S60 30    TUint inputConversionFlags=CCnvCharacterSetConverter::EInputConversionFlagMustEndInDefaultCharacterSet;
   1.337 +    TUint inputConversionFlags=CCnvCharacterSetConverter::EInputConversionFlagMustEndInDefaultCharacterSet |
   1.338 +                               CCnvCharacterSetConverter::EInputConversionFlagAssumeStartInDefaultCharacterSet;
   1.339 +    TInt unconvert = CnvUtilities::ConvertFromUnicode(aDefaultEndiannessOfForeignCharacters,
   1.340 +                                                      aReplacementForUnconvertibleUnicodeCharacters, 
   1.341 +                                                      aForeign, 
   1.342 +                                                      aUnicode, 
   1.343 +                                                      aIndicesOfUnconvertibleCharacters, 
   1.344 +                                                      characterSets.Array(),
   1.345 +                                                      notUsed,
   1.346 +                                                      inputConversionFlags);
   1.347 +        
   1.348 +    characterSets.Close();
   1.349 +
   1.350 +    return unconvert;
   1.351 +    }
   1.352 +
   1.353 +
   1.354 +TInt CISO2022JPConverterImpl::ConvertToUnicode(
   1.355 +        CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
   1.356 +        TDes16& aUnicode, 
   1.357 +        const TDesC8& aForeign, 
   1.358 +        TInt& aState, 
   1.359 +        TInt& aNumberOfUnconvertibleCharacters, 
   1.360 +        TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter)
   1.361 +    {
   1.362 +    return CnvJisBase::ConvertToUnicode(aDefaultEndiannessOfForeignCharacters, aUnicode, aForeign, aState, aNumberOfUnconvertibleCharacters, aIndexOfFirstByteOfFirstUnconvertibleCharacter);
   1.363 +    }
   1.364 +
   1.365 +TBool CISO2022JPConverterImpl::IsInThisCharacterSetL(
   1.366 +        TBool& aSetToTrue, 
   1.367 +        TInt& aConfidenceLevel, 
   1.368 +        const TDesC8& aSample)
   1.369 +    {
   1.370 +    aSetToTrue=ETrue;
   1.371 +    CnvJisBase::IsCharacterJISBased(aConfidenceLevel, aSample);
   1.372 +    return ETrue;
   1.373 +    }
   1.374 +
   1.375 +CISO2022JPConverterImpl* CISO2022JPConverterImpl::NewL()
   1.376 +    {
   1.377 +    CISO2022JPConverterImpl* self = new(ELeave) CISO2022JPConverterImpl();
   1.378 +    CleanupStack::PushL(self);
   1.379 +    self->ConstructL();
   1.380 +    CleanupStack::Pop(self);
   1.381 +    return self;
   1.382 +    }
   1.383 +
   1.384 +CISO2022JPConverterImpl::~CISO2022JPConverterImpl()
   1.385 +    {
   1.386 +    FeatureManager::UnInitializeLib();
   1.387 +    }
   1.388 +
   1.389 +CISO2022JPConverterImpl::CISO2022JPConverterImpl()
   1.390 +    {
   1.391 +    }
   1.392 +
   1.393 +void CISO2022JPConverterImpl::ConstructL()
   1.394 +    {
   1.395 +    FeatureManager::InitializeLibL();
   1.396 +    }
   1.397 +
   1.398 +const TImplementationProxy ImplementationTable[] = 
   1.399 +    {
   1.400 +#ifdef S60_TEST
   1.401 +    IMPLEMENTATION_PROXY_ENTRY(0x01000006,  CISO2022JPConverterImpl::NewL)
   1.402 +#else
   1.403 +    IMPLEMENTATION_PROXY_ENTRY(0x100066A0,  CISO2022JPConverterImpl::NewL)
   1.404 +#endif        
   1.405 +    };
   1.406 +
   1.407 +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
   1.408 +    {
   1.409 +    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
   1.410 +
   1.411 +    return ImplementationTable;
   1.412 +    }
   1.413 +