diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/PDK/Source/GUID-853BFDC0-1993-5EFC-AA68-C9EA496EEF3F.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/PDK/Source/GUID-853BFDC0-1993-5EFC-AA68-C9EA496EEF3F.dita Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,44 @@ + + + + + +Converting +between Unicode and UTF8 +

This tutorial describes the steps to convert between Unicode and UTF8.

+
Introduction

EscapeUtils escape +encodes and decodes unsafe data in URI. It also supports converting of Unicode +data (16-bit descriptor) into UTF8 data (8-bit descriptor) and vice-versa.

+
Procedure

Converting to UTF8

EscapeUtils::ConvertFromUnicodeToUtf8L() converts +the Unicode data into UTF8 format.

_LIT16(KUnicode, "Unicode string"); //data to be converted + +HBufC8* utf8 = EscapeUtils::ConvertFromUnicodeToUtf8L(KUnicode);

utf8 contains +the UTF8 form of the string.

Converting to Unicode

EscapeUtils::ConvertToUnicodeFromUtf8L() converts +the data from UTF8 format to Unicode.

_LIT8(KUtf8, "UTF-8 string"); // UTF8 string to be converted + +HBufC16* unicode = EscapeUtils::ConvertToUnicodeFromUtf8L(KUtf8); // convert the srting to Unicode +

unicode contains the Unicode form +of the string.

Call EscapeUtils::IsEscapeTriple to +check if the input data contains an escape triple. For example, %2a. +If there is a triple, its value is calculated and returned through the output +argument HexVal. If there is no escape triple, then this +argument is left unchanged.

_LIT(KEscapeTriple1, "%2a"); // input data containing escape triple +TInt KEscapeTriple1_value = 0x2a; +TInt HexVal; +EscapeUtils::IsEscapeTriple(KEscapeTriple1,HexVal); // escape triple value +//variable HexVal contains value 0x2a

The code above returns +'42' , the value of escape triple.

+
+HTTP Utilities +Library Overview +Escape encoding +and decoding tutorial +Reserved +and unreserved characters +
\ No newline at end of file