url encoding

Login to reply to this topic.
Tue, 2005-05-10 17:37
Joined: 2005-03-11
Forum posts: 38
Hi all,
Is there anyway to encode the url before sending in symbian ?

A simple symbian enthusiast


Tue, 2005-05-10 19:51
Joined: 2004-07-28
Forum posts: 1379
url encoding
Don't get the question....

didster

Wed, 2005-05-11 09:05
Joined: 2005-03-11
Forum posts: 38
url encoding
Basically in windows when we submit a request http://www.q.com?s=r&d=f it is submitted to IE or http as something like http://www.q.com?s%=#r$&d!~=f

some sort of standard url encoding. .net provides like url.encode() function

is there something like this in symbian ?

A simple symbian enthusiast

Thu, 2005-10-06 08:43
Joined: 2004-10-25
Forum posts: 69
Re: url encoding
Hello,

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.Huh

Thu, 2005-12-01 19:21
Joined: 2005-12-01
Forum posts: 13
Re: url encoding
There is an EscapeEncodeL() function in Class EscapeUtils

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
Fri, 2005-12-02 09:02
Forum Nokia Champion
Joined: 2004-06-30
Forum posts: 36
Re: url encoding
I got this code from Nokia Forum. Works pretty well.

Code:
LOCAL_C HBufC* UrlEncodeL(TDesC& 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::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;
}

  • Login to reply to this topic.