Update contrib.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * J5 charconv character converter
20 #if !defined(__J5_H__)
24 J5 charconv character converter which supports automatic conversion for the following
26 SHIFT-JIS (Windows-31J Microsoft code page 932),
27 ISO-2022-JP-1 (JIS-JP)
34 class CJ5Converter : public CCharacterSetConverterPluginInterface
48 virtual const TDesC8& ReplacementForUnconvertibleUnicodeCharacters();
50 virtual TInt ConvertFromUnicode(
51 CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
52 const TDesC8& aReplacementForUnconvertibleUnicodeCharacters,
54 const TDesC16& aUnicode,
55 CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters);
57 virtual TInt ConvertToUnicode(
58 CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
60 const TDesC8& aForeign,
62 TInt& aNumberOfUnconvertibleCharacters,
63 TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
65 virtual TBool IsInThisCharacterSetL(
67 TInt& aConfidenceLevel,
68 const TDesC8& aSample);
70 static CJ5Converter* NewL();
71 virtual ~CJ5Converter();
77 enum TDectectCharacterSet
84 enum TJ5Encoding DetectEncoding(
85 CCnvCharacterSetConverter::TEndianness& aDefaultEndiannessOfForeignCharacters,
86 const TDesC8& aForeign );
88 TBool DetectUcs2( const TDesC8& aForeign,
89 CCnvCharacterSetConverter::TEndianness& aTEndianness );
91 enum TDectectCharacterSet DetectShiftJis( const TDesC8& aForeign,
92 TInt &aNumberOfBytesConverted );
94 enum TDectectCharacterSet DetectUtf8( const TDesC8& aForeign );
96 enum TDectectCharacterSet DetectEucJp( const TDesC8& aForeign,
97 TInt &aNumberOfBytesConverted );
99 enum TDectectCharacterSet DetectIso2022( const TDesC8& aForeign );
101 TInt ConvertEEucjpToUnicode(
102 CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
104 const TDesC8& aForeign,
106 TInt& aNumberOfUnconvertibleCharacters,
107 TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
109 TInt ConvertUcs2ToUnicode(CCnvCharacterSetConverter::TEndianness& aDefaultEndiannessOfForeignCharacters,
111 const TDesC8& aForeign,
112 TInt& aNumberOfUnconvertibleCharacters,
113 TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
119 // EucJp conversion methods
120 void DummyConvertToIntermediateBufferInPlace(TDes8&);
121 void ConvertToJisX0212FromEucJpPackedInPlace(TDes8& aDescriptor);
122 void ConvertToJisX0208FromEucJpPackedInPlace(TDes8& aDescriptor);
123 void ConvertToHalfWidthKatakana8FromEucJpPackedInPlace(TDes8& aDescriptor);
124 TInt NumberOfBytesAbleToConvertToJisRoman(const TDesC8& aDescriptor);
125 TInt NumberOfBytesAbleToConvertToJisX0208(const TDesC8& aDescriptor);
126 TInt NumberOfBytesAbleToConvertToHalfWidthKatakana8(const TDesC8& aDescriptor);
127 TInt NumberOfBytesAbleToConvertToJisX0212(const TDesC8& aDescriptor);