// Alloc to the maximum size of URL if every char are encoded HBufC *sEncoded = HBufC::NewL(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. sEncoded->Des().AppendFormat(KFormatCode, cToFind); } else { // char found just copy it sEncoded->Des().Append(cToFind); } }
// Reallocate to the real size of the encoded url. sEncoded->ReAllocL(sEncoded->Length());
Forum posts: 1379
didster
Forum posts: 38
some sort of standard url encoding. .net provides like url.encode() function
is there something like this in symbian ?
A simple symbian enthusiast
Forum posts: 69
has some one been able to do URL Encoding in Symbian.
I am going a get request as follows.
http://example.com/example.jsp?eg=Some text with space
this is crashing the server as it is not able to read this properly. It should go in as
http://example.com/example.jsp?eg=Some%20text%20with%20space
OR
http://example.com/example.jsp?eg=Some text with+space+and+other+characters
How do I do this kind of URL Encoding?
Or is there anything I can do at the server side.
Forum posts: 13
Location: EscapeUtils.h
Link against: InetProtUtil.lib
http://www.symbian.com//developer/techlib/v70sdocs/doc_source/reference/cpp/InternetUtilityProtocol/EscapeUtilsClass.html
It's only supported from 7.0 though, I'm not sure if anyone has written a version for 6.1
Forum posts: 36
{
_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::NewL(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.
sEncoded->Des().AppendFormat(KFormatCode, cToFind);
}
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;
}