textandloc_pub/character_conversion_api/inc/CHARCONV.H
changeset 0 1fb32624e06b
child 3 1509585cd8bf
child 16 56cd22a7a1cb
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /*
       
     2 * Copyright (c) 1997-2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #if !defined(__CHARCONV_H__)
       
    21 #define __CHARCONV_H__
       
    22 
       
    23 #if !defined(__E32STD_H__)
       
    24 #include <e32std.h>
       
    25 #endif
       
    26 
       
    27 #if !defined(__E32BASE_H__)
       
    28 #include <e32base.h>
       
    29 #endif
       
    30 
       
    31 /** 
       
    32 The maximum length in bytes of the replacement text for unconvertible Unicode 
       
    33 characters (=50) (see CCnvCharacterSetConverter::SetReplacementForUnconvertibleUnicodeCharactersL()). 
       
    34 @publishedAll
       
    35 @released
       
    36 */
       
    37 const TInt KMaximumLengthOfReplacementForUnconvertibleUnicodeCharacters=50;
       
    38 
       
    39 /** 
       
    40 UTF-7 
       
    41 @publishedAll
       
    42 @released
       
    43 */
       
    44 const TUint KCharacterSetIdentifierUtf7=0x1000582c;
       
    45 /** 
       
    46 UTF-8 
       
    47 @publishedAll
       
    48 @released
       
    49 */
       
    50 const TUint KCharacterSetIdentifierUtf8=0x1000582d;
       
    51 /** 
       
    52 IMAP UTF-7 
       
    53 @publishedAll
       
    54 @released
       
    55 */
       
    56 const TUint KCharacterSetIdentifierImapUtf7=0x1000582e;
       
    57 /** 
       
    58 Java UTF-8 
       
    59 @publishedAll
       
    60 @released
       
    61 */
       
    62 const TUint KCharacterSetIdentifierJavaConformantUtf8=0x1000582f;
       
    63 /** 
       
    64 Code Page 1252 
       
    65 @publishedAll
       
    66 @released
       
    67 */
       
    68 const TUint KCharacterSetIdentifierCodePage1252=0x100012b6;
       
    69 /** 
       
    70 ISO 8859-1 
       
    71 @publishedAll
       
    72 @released
       
    73 */
       
    74 const TUint KCharacterSetIdentifierIso88591=0x10003b10;
       
    75 /** 
       
    76 ISO 8859-2 
       
    77 @publishedAll
       
    78 @released
       
    79 */
       
    80 const TUint KCharacterSetIdentifierIso88592=0x1000507e;
       
    81 /** 
       
    82 ISO 8859-3 
       
    83 @publishedAll
       
    84 @released
       
    85 */
       
    86 const TUint KCharacterSetIdentifierIso88593=0x10008a28;
       
    87 /** 
       
    88 ISO 8859-4 
       
    89 @publishedAll
       
    90 @released
       
    91 */
       
    92 const TUint KCharacterSetIdentifierIso88594=0x1000507f;
       
    93 /** 
       
    94 ISO 8859-5 
       
    95 @publishedAll
       
    96 @released
       
    97 */
       
    98 const TUint KCharacterSetIdentifierIso88595=0x10005080;
       
    99 /** 
       
   100 ISO 8859-6 
       
   101 @publishedAll
       
   102 @released
       
   103 */
       
   104 const TUint KCharacterSetIdentifierIso88596=0x10008a29;
       
   105 /** 
       
   106 ISO 8859-7 
       
   107 @publishedAll
       
   108 @released
       
   109 */
       
   110 const TUint KCharacterSetIdentifierIso88597=0x10005081;
       
   111 /** 
       
   112 ISO 8859-8 
       
   113 @publishedAll
       
   114 @released
       
   115 */
       
   116 const TUint KCharacterSetIdentifierIso88598=0x10008a2a;
       
   117 /** 
       
   118 ISO 8859-9 
       
   119 @publishedAll
       
   120 @released
       
   121 */
       
   122 const TUint KCharacterSetIdentifierIso88599=0x10005082;
       
   123 /** 
       
   124 ISO 8859-10 
       
   125 @publishedAll
       
   126 @released
       
   127 */
       
   128 const TUint KCharacterSetIdentifierIso885910=0x10008a2b;
       
   129 /** 
       
   130 ISO 8859-13 
       
   131 @publishedAll
       
   132 @released
       
   133 */
       
   134 const TUint KCharacterSetIdentifierIso885913=0x10008a2c;
       
   135 /** 
       
   136 ISO 8859-14 
       
   137 @publishedAll
       
   138 @released
       
   139 */
       
   140 const TUint KCharacterSetIdentifierIso885914=0x10008a2d;
       
   141 /** 
       
   142 ISO 8859-15 
       
   143 @publishedAll
       
   144 @released
       
   145 */
       
   146 const TUint KCharacterSetIdentifierIso885915=0x10008a2e;
       
   147 /** 
       
   148 ASCII 
       
   149 @publishedAll
       
   150 @released
       
   151 */
       
   152 const TUint KCharacterSetIdentifierAscii=0x10004cc6;
       
   153 /** 
       
   154 SMS 7-bit 
       
   155 @publishedAll
       
   156 @released
       
   157 */
       
   158 const TUint KCharacterSetIdentifierSms7Bit=0x100053ab;
       
   159 /** 
       
   160 GB 2312 
       
   161 @publishedAll
       
   162 @released
       
   163 */
       
   164 const TUint KCharacterSetIdentifierGb2312=0x10000fbe;
       
   165 /** 
       
   166 HZ-GB-2312 
       
   167 @publishedAll
       
   168 @released
       
   169 */
       
   170 const TUint KCharacterSetIdentifierHz=0x10006065;
       
   171 /** 
       
   172 GB 12345 
       
   173 @publishedAll
       
   174 @released
       
   175 */
       
   176 const TUint KCharacterSetIdentifierGb12345=0x1000401a;
       
   177 /** 
       
   178 GBK 
       
   179 @publishedAll
       
   180 @released
       
   181 */
       
   182 const TUint KCharacterSetIdentifierGbk=0x10003ecb;
       
   183 /** 
       
   184 Big 5 
       
   185 @publishedAll
       
   186 @released
       
   187 */
       
   188 const TUint KCharacterSetIdentifierBig5=0x10000fbf;
       
   189 /** 
       
   190 Shift-JIS 
       
   191 @publishedAll
       
   192 @released
       
   193 */
       
   194 const TUint KCharacterSetIdentifierShiftJis=0x10000fbd;
       
   195 /** 
       
   196 ISO-2022-JP 
       
   197 @publishedAll
       
   198 @released
       
   199 */
       
   200 const TUint KCharacterSetIdentifierIso2022Jp=0x100066a0;
       
   201 /** 
       
   202 ISO-2022-JP-1 
       
   203 @publishedAll
       
   204 @released
       
   205 */
       
   206 const TUint KCharacterSetIdentifierIso2022Jp1=0x100066a3;
       
   207 /** 
       
   208 JIS Encoding 
       
   209 @publishedAll
       
   210 @released
       
   211 */
       
   212 const TUint KCharacterSetIdentifierJis=0x10006066;
       
   213 /** 
       
   214 EUC-JP 
       
   215 @publishedAll
       
   216 @released
       
   217 */
       
   218 const TUint KCharacterSetIdentifierEucJpPacked=0x10006067;
       
   219 
       
   220 /** 
       
   221 JP5 
       
   222 @publishedAll
       
   223 @released
       
   224 */
       
   225 const TUint KCharacterSetIdentifierJ5=0x1020D408;
       
   226 const TUint KCharacterSetIdentifierCP850=0x102825AD;
       
   227 
       
   228 const TUint KCharacterSetIdentifierUnicodeLittle=0x101f3fae;  //Little Endian Unicode
       
   229 const TUint KCharacterSetIdentifierUnicodeBig=0x101f4052; // Big Endian Unicode 
       
   230 const TUint KCharacterSetIdentifierUcs2=0x101ff492; 
       
   231 
       
   232 /** 
       
   233 Extended SMS 7-bit (not supported before v9.5) 
       
   234 @publishedAll
       
   235 @released
       
   236 */
       
   237 const TUint KCharacterSetIdentifierExtendedSms7Bit=0x102863FD;
       
   238 
       
   239 /** 
       
   240 Turkish 
       
   241 @publishedAll
       
   242 @released
       
   243 */
       
   244 const TUint KCharacterSetIdentifierTurkishSingleSms7Bit=0x102863FE;
       
   245 const TUint KCharacterSetIdentifierTurkishLockingSms7Bit=0x102863FF;
       
   246 const TUint KCharacterSetIdentifierTurkishLockingAndSingleSms7Bit=0x10286400;
       
   247 
       
   248 /** 
       
   249 Portuguese 
       
   250 @publishedAll
       
   251 @released
       
   252 */
       
   253 const TUint KCharacterSetIdentifierPortugueseSingleSms7Bit=0x10286407;
       
   254 const TUint KCharacterSetIdentifierPortugueseLockingSms7Bit=0x10286408;
       
   255 const TUint KCharacterSetIdentifierPortugueseLockingAndSingleSms7Bit=0x10286409;
       
   256 
       
   257 /** 
       
   258 Spanish
       
   259 @publishedAll
       
   260 @released
       
   261 */
       
   262 const TUint KCharacterSetIdentifierSpanishSingleSms7Bit=0x1028640A;
       
   263  
       
   264 /**
       
   265 Shift-JIS with Pictograph
       
   266 @publishedAll
       
   267 @released 
       
   268 */
       
   269 const TUint KCharacterSetIdentifierShiftJisDirectmap=0x101F8691;
       
   270 
       
   271 /**
       
   272 EUC-JP with direct mapped pictograph
       
   273 @publishedAll
       
   274 @released 
       
   275 */
       
   276 const TUint KCharacterSetIdentifierEucJpDirectmap=0x101F86A6;
       
   277 // note that other character sets than those listed above may be available at run-time, and also that none of the above are necessarily available at run-time
       
   278 
       
   279 struct SCnvConversionData;
       
   280 class CDeepDestructingArrayOfCharactersSets;
       
   281 class CFileReader;
       
   282 class CStandardNamesAndMibEnums;
       
   283 class RFs;
       
   284 class CCharsetCnvCache;
       
   285 /** 
       
   286 Converts text between Unicode and other character sets. 
       
   287 
       
   288 The first stage of the conversion is to specify the non-Unicode character 
       
   289 set being converted to or from. This is done by calling one of the overloads 
       
   290 of PrepareToConvertToOrFromL().
       
   291 
       
   292 The second stage is to convert the text, using one of the overloads of 
       
   293 ConvertFromUnicode() or ConvertToUnicode().
       
   294 
       
   295 Where possible the first documented overload of PrepareToConvertToOrFromL() 
       
   296 should be used because the second overload panics if the specified character 
       
   297 set is not available: the first overload simply returns whether the character 
       
   298 set is available or not available. However if the conversions are to be 
       
   299 performed often, or if the user must select the character set for the 
       
   300 conversion from a list, the second overload may be more appropriate.
       
   301 
       
   302 The first overload is less efficient than the second, because it searches 
       
   303 through the file system for the selected character set every time it is invoked. 
       
   304 The second overload searches through an array of all available character sets. 
       
   305 In this method, the file system need only be searched once - when 
       
   306 CreateArrayOfCharacterSetsAvailableLC() or 
       
   307 CreateArrayOfCharacterSetsAvailableL() is used to create the array.
       
   308 
       
   309 The conversion functions allow users of this class to perform partial 
       
   310 conversions on an input descriptor, handling the situation where the input 
       
   311 descriptor is truncated mid way through a multi-byte character. This means 
       
   312 that you do not have to guess how big to make the output descriptor for a 
       
   313 given input descriptor, you can simply do the conversion in a loop using a 
       
   314 small output descriptor. The ability to handle truncated descriptors also 
       
   315 allows users of the class to convert information received in chunks from an 
       
   316 external source.
       
   317 
       
   318 The class also provides a number of utility functions. 
       
   319 @publishedAll
       
   320 @released
       
   321 */
       
   322 class CCnvCharacterSetConverter : public CBase
       
   323 	{
       
   324 public:
       
   325 	/** Indicates whether a character set is available or unavailable 
       
   326 	for conversion. Used by the second overload of 
       
   327 	PrepareToConvertToOrFromL(). */
       
   328 	enum TAvailability
       
   329 		{
       
   330 		/** The requested character set can be converted. */
       
   331 		EAvailable,
       
   332 		/** The requested character set cannot be converted. */
       
   333 		ENotAvailable
       
   334 		};
       
   335 
       
   336 	/** Conversion error flags. At this stage there is only one error 
       
   337 	flag- others may be added in the future. */
       
   338 	enum TError
       
   339 		{
       
   340 		/** The input descriptor contains a single corrupt character. This 
       
   341 		might occur when the input descriptor only contains some of the bytes 
       
   342 		of a single multi-byte character. */
       
   343 		EErrorIllFormedInput=KErrCorrupt
       
   344 		};
       
   345 
       
   346 	/** Specifies the default endian-ness of the current character set. 
       
   347 	Used by SetDefaultEndiannessOfForeignCharacters(). */
       
   348 	enum TEndianness
       
   349 		{
       
   350 		/** The character set is big-endian. */
       
   351 		ELittleEndian,
       
   352 		/** The character set is little-endian. */
       
   353 		EBigEndian
       
   354 		};
       
   355 	
       
   356 	/** Downgrade for line and paragraph separators */
       
   357 	enum TDowngradeForExoticLineTerminatingCharacters
       
   358 		{
       
   359 		/** Paragraph/line separators should be downgraded (if necessary) 
       
   360 		into carriage return and line feed pairs. */
       
   361 		EDowngradeExoticLineTerminatingCharactersToCarriageReturnLineFeed,
       
   362 		/** Paragraph/line separators should be downgraded (if necessary) 
       
   363 		into a line feed only. */
       
   364 		EDowngradeExoticLineTerminatingCharactersToJustLineFeed
       
   365 		};
       
   366 
       
   367 	/** Output flag used to indicate whether or not a character in the source
       
   368 	descriptor is the first half of a surrogate pair, but is the last
       
   369 	character in the descriptor to convert.
       
   370 	 
       
   371 	Note: This enumeration can be used in the DoConvertToUnicode() and
       
   372 	DoConvertFromUnicode() functions. These are part of the
       
   373 	Character Conversion Plug-in Provider API and are for use by plug-in
       
   374 	conversion libraries only.
       
   375 	@since 6.0 */
       
   376 	enum
       
   377 		{
       
   378 		/** Appends the converted text to the output descriptor.*/
       
   379 		EInputConversionFlagAppend	=0x00010000,
       
   380 		/** By default, when the input descriptor passed to DoConvertFromUnicode()
       
   381 		or DoConvertToUnicode() consists of nothing but a truncated sequence, 
       
   382 		the error-code EErrorIllFormedInput is returned. 
       
   383 		If this behaviour is undesirable, the input flag  
       
   384 		EInputConversionFlagAllowTruncatedInputNotEvenPartlyConsumable
       
   385 		should be set. */
       
   386 		EInputConversionFlagAllowTruncatedInputNotEvenPartlyConsumable	=0x00020000,
       
   387 		/** Stops converting when the first unconvertible character is reached. */
       
   388 		EInputConversionFlagStopAtFirstUnconvertibleCharacter			=0x00040000,
       
   389 		/** Appends the default character set Escape sequence at end of converted text */
       
   390 		EInputConversionFlagMustEndInDefaultCharacterSet				=0x00080000,
       
   391 		/*defect fix: INC053609; According to RFC1468 we can assume the line starts 
       
   392 		in ASCII so there is no need to always insert an escape sequence*/
       
   393 		EInputConversionFlagAssumeStartInDefaultCharacterSet			=0x00100000
       
   394 		};
       
   395 	enum
       
   396 		{
       
   397 		/** Indicates whether or not the source descriptor ends in a truncated
       
   398 		sequence, e.g. the first half only of a surrogate pair. */
       
   399 		EOutputConversionFlagInputIsTruncated							=0x01000000
       
   400 		};
       
   401 
       
   402 		/** Initial value for the state argument in a set of related calls to
       
   403 		ConvertToUnicode(). */
       
   404 	enum {KStateDefault=0};
       
   405 	enum 
       
   406 		{
       
   407 		/** The lowest confidence value for a character set accepted by 
       
   408 		Autodetect*/
       
   409 		ELowestThreshold = 25
       
   410 		};
       
   411 		
       
   412 	/** Stores information about a non-Unicode character set. The information 
       
   413 	is used	to locate the conversion information required by 
       
   414 	ConvertFromUnicode() and ConvertToUnicode().
       
   415 
       
   416 	An array of these structs that contain all available character sets 
       
   417 	can be generated by CreateArrayOfCharacterSetsAvailableLC() and 
       
   418 	CreateArrayOfCharacterSetsAvailableL(), and is used by one of the 
       
   419 	overloads of PrepareToConvertToOrFromL(). */
       
   420 	struct SCharacterSet
       
   421 		{
       
   422 		/** Gets the character sets UID.
       
   423 	
       
   424 		@return The UID of the character set. */
       
   425 		inline TUint Identifier() const {return iIdentifier;}
       
   426 
       
   427 		/** Tests whether a filename given by the function SCharacterSet::Name() 
       
   428 		is a real file name (i.e. conversion is provided by a plug in DLL), or 
       
   429 		just the character set name (i.e. conversion is built into Symbian OS).
       
   430 		
       
   431 		Note: If the function returns ETrue then the path and filename can be 
       
   432 		parsed using TParse or TParsePtrC functions to obtain just the filename.
       
   433 		
       
   434 		@return ETrue if the name is a real filename. EFalse if it is just the 
       
   435 		character set name. */
       
   436 		inline TBool NameIsFileName() const {return iFlags&EFlagNameIsFileName;}
       
   437 
       
   438 		/** Gets the full path and filename of the DLL which implements 
       
   439 		conversion for the character set. 
       
   440 		
       
   441 		If the character set is one for which conversion is built into Symbian 
       
   442 		OS rather than implemented by a plug in DLL, the function just returns 
       
   443 		the name of the character set. The NameIsFileName() function can be 
       
   444 		used to determine whether or not it is legal to create a TParsePtrC 
       
   445 		object over the descriptor 	returned by Name().
       
   446 		
       
   447 		Notes:
       
   448 		
       
   449 		The name returned cannot be treated as an Internet-standard name, it 
       
   450 		is locale-independent and should be mapped to the locale-dependent name 
       
   451 		by software at a higher level before being shown to the user. Conversion 
       
   452 		from Internet-standard names of character sets to the UID identifiers 
       
   453 		is provided by the member function 
       
   454 		ConvertStandardNameOfCharacterSetToIdentifierL().
       
   455 		
       
   456 		Typically, to find the user-displayable name (as opposed to the 
       
   457 		internet-standard name) of a character set, you would do something 
       
   458 		like this:
       
   459 		
       
   460 		@code
       
   461 		const CCnvCharacterSetConverter::SCharacterSet& characterSet=...;
       
   462 		const TPtrC userDisplayable(characterSet.NameIsFileName()? TParsePtrC(characterSet.Name()).Name(): 
       
   463 		characterSet.Name()); 
       
   464 		@endcode
       
   465 
       
   466 		@return Full path and filename of the character set converter plug in 
       
   467 		DLL, or just the name of the character set. */
       
   468 		inline TPtrC Name() const {return *iName;}
       
   469 	private:
       
   470 		enum
       
   471 			{
       
   472 			EFlagNameIsFileName					=0x00000001,
       
   473 			EFlagFileIsConversionPlugInLibrary	=0x00000002
       
   474 			};
       
   475 	private:
       
   476 		inline TBool FileIsConversionPlugInLibrary() const {return iFlags&EFlagFileIsConversionPlugInLibrary;}
       
   477 	private:
       
   478 		TUint iIdentifier;
       
   479 		TUint iFlags;
       
   480 		HBufC* iName;
       
   481 	private:
       
   482 		friend class CCnvCharacterSetConverter;
       
   483 		friend class CDeepDestructingArrayOfCharactersSets;
       
   484 		}; //SCharacterSet
       
   485 	
       
   486 
       
   487 	/** 
       
   488 	Holds an ascending array of the indices of the characters in the 
       
   489 	source Unicode text which could not be converted by 
       
   490 	CCnvCharacterSetConverter::ConvertFromUnicode() into the foreign 
       
   491 	character set 
       
   492 	@publishedAll
       
   493 	@released
       
   494 	*/
       
   495 	class TArrayOfAscendingIndices
       
   496 		{
       
   497 	public:
       
   498 		/** The return value of CCnvCharacterSetConverter::AppendIndex(). */
       
   499 		enum TAppendResult
       
   500 			{
       
   501 			/** The append failed. */
       
   502 			EAppendFailed,
       
   503 			/** The append succeeded. */
       
   504 			EAppendSuccessful
       
   505 			};
       
   506 	public:
       
   507 		/** C++ constructor. The array is initialised to be of length zero. */
       
   508 		inline TArrayOfAscendingIndices() :iArrayOfIndices(0) {}
       
   509 	
       
   510 		IMPORT_C TAppendResult AppendIndex(TInt aIndex);
       
   511 		
       
   512 		/** Deletes a single index from the array.
       
   513 		
       
   514 		@param aIndexOfIndex The index of the index to delete. Must not be 
       
   515 		negative and must not be greater than the length of the array, or a 
       
   516 		panic occurs. */
       
   517 		inline void Remove(TInt aIndexOfIndex) {iArrayOfIndices.Delete(aIndexOfIndex, 1);}
       
   518 		
       
   519 		/** Deletes all indices from the array. */
       
   520 		inline void RemoveAll() {iArrayOfIndices.SetLength(0);}
       
   521 
       
   522 		/** Returns the number of indices in the array.
       
   523 	
       
   524 		@return The number of indices in the array. */
       
   525 		inline TInt NumberOfIndices() const {return iArrayOfIndices.Length();}
       
   526 
       
   527 		/** Gets the value of the specified index.
       
   528 	
       
   529 		@param aIndexOfIndex Index into the array.
       
   530 		@return The value of the index. */
       
   531 		inline TInt operator[](TInt aIndexOfIndex) const {return iArrayOfIndices[aIndexOfIndex];}
       
   532 	private:
       
   533 		enum {KMaximumNumberOfIndices=25};
       
   534 	private:
       
   535 		TBuf16<KMaximumNumberOfIndices> iArrayOfIndices;
       
   536 		};
       
   537 public:
       
   538 	IMPORT_C static CCnvCharacterSetConverter* NewL();
       
   539 	IMPORT_C static CCnvCharacterSetConverter* NewLC();
       
   540 	IMPORT_C virtual ~CCnvCharacterSetConverter();
       
   541 	IMPORT_C static CArrayFix<SCharacterSet>* CreateArrayOfCharacterSetsAvailableL(RFs& aFileServerSession);
       
   542 	IMPORT_C static CArrayFix<SCharacterSet>* CreateArrayOfCharacterSetsAvailableLC(RFs& aFileServerSession);
       
   543 	IMPORT_C TUint ConvertStandardNameOfCharacterSetToIdentifierL(const TDesC8& aStandardNameOfCharacterSet, RFs& aFileServerSession);
       
   544 	IMPORT_C HBufC8* ConvertCharacterSetIdentifierToStandardNameL(TUint aCharacterSetIdentifier, RFs& aFileServerSession);
       
   545 	IMPORT_C TUint ConvertMibEnumOfCharacterSetToIdentifierL(TInt aMibEnumOfCharacterSet, RFs& aFileServerSession);
       
   546 	IMPORT_C TInt ConvertCharacterSetIdentifierToMibEnumL(TUint aCharacterSetIdentifier, RFs& aFileServerSession);
       
   547 	IMPORT_C void PrepareToConvertToOrFromL(TUint aCharacterSetIdentifier, const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, RFs& aFileServerSession);
       
   548 	IMPORT_C TAvailability PrepareToConvertToOrFromL(TUint aCharacterSetIdentifier, RFs& aFileServerSession);
       
   549 	// the following attribute-setting functions should be called (if at all) after calling PrepareToConvertToOrFromL and before calling ConvertFromUnicode and/or ConvertToUnicode
       
   550 	IMPORT_C void SetDefaultEndiannessOfForeignCharacters(TEndianness aEndianness);
       
   551 	IMPORT_C void SetDowngradeForExoticLineTerminatingCharacters(TDowngradeForExoticLineTerminatingCharacters aDowngradeForExoticLineTerminatingCharacters); // by default this attribute is set to EDowngradeExoticLineTerminatingCharactersToCarriageReturnLineFeed
       
   552 	IMPORT_C void SetReplacementForUnconvertibleUnicodeCharactersL(const TDesC8& aReplacementForUnconvertibleUnicodeCharacters); // must be a single character preceded by its escape sequence (if any), and must be little-endian if the endianness of the character-set is unspecified, otherwise in the same endianness as the character-set
       
   553 	
       
   554 	// the conversion functions return either one of the TError values above, or the number of unconverted elements left at the end of the input descriptor
       
   555 	IMPORT_C TInt ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode) const;
       
   556 	IMPORT_C TInt ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TInt& aNumberOfUnconvertibleCharacters) const;
       
   557 	IMPORT_C TInt ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstUnconvertibleCharacter) const;
       
   558 	IMPORT_C TInt ConvertFromUnicode(TDes8& aForeign, const TDesC16& aUnicode, TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters) const;
       
   559 	IMPORT_C TInt ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign, TInt& aState) const;
       
   560 	IMPORT_C TInt ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign, TInt& aState, TInt& aNumberOfUnconvertibleCharacters) const;
       
   561 	IMPORT_C TInt ConvertToUnicode(TDes16& aUnicode, const TDesC8& aForeign, TInt& aState, TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter) const;
       
   562 	IMPORT_C static void AutoDetectCharacterSetL(TInt& aConfidenceLevel, TUint& aCharacterSetIdentifier, const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, const TDesC8& aSample);
       
   563 	IMPORT_C void AutoDetectCharSetL(TInt& aConfidenceLevel, TUint& aCharacterSetIdentifier, const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, const TDesC8& aSample);
       
   564 	IMPORT_C static void ConvertibleToCharacterSetL(TInt& aConfidenceLevel, const TUint aCharacterSetIdentifier,const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, const TDesC8& aSample);
       
   565     IMPORT_C void ConvertibleToCharSetL(TInt& aConfidenceLevel, const TUint aCharacterSetIdentifier,const CArrayFix<SCharacterSet>& aArrayOfCharacterSetsAvailable, const TDesC8& aSample);
       
   566 	IMPORT_C void SetMaxCacheSize(TInt aSize);
       
   567 	// the following functions are only to be called by conversion plug-in libraries
       
   568 	IMPORT_C static TInt DoConvertFromUnicode(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters, const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, TDes8& aForeign, const TDesC16& aUnicode, TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters);
       
   569 	IMPORT_C static TInt DoConvertFromUnicode(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters, const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, TDes8& aForeign, const TDesC16& aUnicode, TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters, TUint& aOutputConversionFlags, TUint aInputConversionFlags);
       
   570 	IMPORT_C static TInt DoConvertToUnicode(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters, TDes16& aUnicode, const TDesC8& aForeign, TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter);
       
   571 	IMPORT_C static TInt DoConvertToUnicode(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters, TDes16& aUnicode, const TDesC8& aForeign, TInt& aNumberOfUnconvertibleCharacters, TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter, TUint& aOutputConversionFlags, TUint aInputConversionFlags);
       
   572 	IMPORT_C static const SCnvConversionData& AsciiConversionData();
       
   573 	inline TDowngradeForExoticLineTerminatingCharacters GetDowngradeForExoticLineTerminatingCharacters () 
       
   574 		{
       
   575 		return iDowngradeForExoticLineTerminatingCharacters ;
       
   576 		} ; 
       
   577 
       
   578 private:
       
   579 	enum
       
   580 		{
       
   581 		EStoredFlagOwnsConversionData				=0x00000001,
       
   582 		EStoredFlagConversionPlugInLibraryIsLoaded	=0x00000002
       
   583 		};
       
   584 	enum TCharacterSetSearch
       
   585 		{
       
   586 		EStopCharacterSetSearch,
       
   587 		EContinueCharacterSetSearch
       
   588 		};
       
   589 	enum TConversionPlugInFunctionOrdinals
       
   590 		{
       
   591 		EReplacementForUnconvertibleUnicodeCharacters=1,
       
   592 		EConvertFromUnicode=2,
       
   593 		EConvertToUnicode=3,
       
   594 		EIsInThisCharacterSet=4
       
   595 		};
       
   596 		
       
   597 private:
       
   598 	CCnvCharacterSetConverter();
       
   599 	void ConstructL();
       
   600 	static CArrayFix<SCharacterSet>* DoCreateArrayOfCharacterSetsAvailableLC(RFs& aFileServerSession, TUint aIdentifierOfOnlyCharacterSetOfInterest);
       
   601 	static TCharacterSetSearch AppendHardCodedCharacterSetIfRequiredL(CArrayFix<SCharacterSet>& aArrayOfCharacterSets, TUint aIdentifierOfOnlyCharacterSetOfInterest, TUint aIdentifierOfHardCodedCharacterSet, const TDesC& aNameOfHardCodedCharacterSet);
       
   602 	void ScanForStandardNamesAndMibEnumsL(RFs& aFileServerSession);
       
   603 	void ScanForStandardNamesAndMibEnumsROMOnlyL(RFs& aFileServerSession);
       
   604 	TAvailability DoPrepareToConvertToOrFromL(TUint aCharacterSetIdentifier, const CArrayFix<SCharacterSet>* aArrayOfCharacterSetsAvailable, RFs& aFileServerSession);
       
   605 	static void DeleteConversionData(const SCnvConversionData* aConversionData);
       
   606 	static void DeleteConversionData(TAny* aConversionData);
       
   607 	static TEndianness EndiannessOfForeignCharacters(const SCnvConversionData& aConversionData, TEndianness aDefaultEndiannessOfForeignCharacters);
       
   608 
       
   609 private:
       
   610 	TUint iStoredFlags;
       
   611 	TUint iCharacterSetIdentifierOfLoadedConversionData; // 0 or a UID of the loaded plugin
       
   612 	const SCnvConversionData* iConversionData;
       
   613 	TEndianness iDefaultEndiannessOfForeignCharacters;
       
   614 	TDowngradeForExoticLineTerminatingCharacters iDowngradeForExoticLineTerminatingCharacters;
       
   615 	TBuf8<KMaximumLengthOfReplacementForUnconvertibleUnicodeCharacters> iReplacementForUnconvertibleUnicodeCharacters;
       
   616 	CStandardNamesAndMibEnums* iStandardNamesAndMibEnums;
       
   617 	TBool iFullyConstructed;
       
   618 	CCharsetCnvCache* iCharsetCnvCache;
       
   619 	};
       
   620 
       
   621 #endif
       
   622