Also i am using the following code to encode the url:
I am not sure if this encodes in utf-8 format. Do you think this is correct?
Code:
HBufC* CWebClient::UrlEncodeL(TDes& aUrl)
{
_LIT(KFormatCode, "%%%02x");
if (!aUrl.Length())
{
return NULL;
}
TBufC<100> sDontEncode = _L("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!-_.()*;/?:@&=+$[]!\\'()~");
// Alloc to the maximum size of URL if every char are encoded
HBufC *sEncoded = HBufC::NewLC(aUrl.Length() * 3);
// Parse a the chars in the url
for (TInt i=0; i<aUrl.Length(); i++)
{
TChar cToFind = aUrl[i];
if (KErrNotFound == sDontEncode.Locate(cToFind) )
{
// Char not found encode it.
TUint c = (TUint) cToFind;
sEncoded->Des().AppendFormat(KFormatCode, c);
}
else
{
// char found just copy it
sEncoded->Des().Append(cToFind);
}
}
// Reallocate to the real size of the encoded url.
sEncoded->ReAllocL(sEncoded->Length());
return sEncoded;
}