×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Oct 2007
    Location
    India
    Posts
    349

    Problem with & in QByteArray ?

    I have a QByteArray to post some text on Facebook wall, below is the code snippet. I have a problem if string contains & symbol.

    Code:
    QByteArray data;
    
        if (!stringOne.isEmpty()) {
            data.append(QString("message=").append(stringOne));
        }
    
        if (!stringTwo.isEmpty()) {
            data.append(QString("&name=").append(stringTwo));
        }
    
    m_reply = qfaceBook->putObject("me", "feed", data);   
    // Function Declaration putOjbect(QString arg1,  QString arg2, QVariant arg3);
    The code is working fine except following condition:

    If stringOne contains text like "I love Forum Nokia & Nokia Phones" then it accepts only "I love Forum Nokia " and from "&" it is not accepting. What can be problem. Is this something to URL Encoded related or something else...
    Last edited by narendar_discover; 2011-05-17 at 07:57. Reason: code missing...

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Problem with & in QByteArray ?

    Yes, as you can see it uses byte array as HTTP POST data
    https://gitorious.org/qfacebook/qfac...api.cpp#line45

  3. #3
    Regular Contributor
    Join Date
    Oct 2007
    Location
    India
    Posts
    349

    Re: Problem with & in QByteArray ?

    Quote Originally Posted by divanov View Post
    Yes, as you can see it uses byte array as HTTP POST data
    https://gitorious.org/qfacebook/qfac...api.cpp#line45
    But before posting I am converting it from QVariant to QByteArray
    reply = m_networkManager->post(request, postArgs.toByteArray());

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Problem with & in QByteArray ?

    Quote Originally Posted by narendar_discover View Post
    But before posting I am converting it from QVariant to QByteArray
    reply = m_networkManager->post(request, postArgs.toByteArray());
    QVariant::toByteArray() doesn't perform percent encoding.

  5. #5
    Regular Contributor
    Join Date
    Oct 2007
    Location
    India
    Posts
    349

    Re: Problem with & in QByteArray ?

    Okay, let me convert QVariant Parameter with QByteArray

  6. #6
    Registered User
    Join Date
    Jul 2004
    Posts
    166

    Re: Problem with & in QByteArray ?

    you want to do something link this

    QByteArray QUrl::encodedQuery ()

    see QUrl doc for more info.
    http://kunalmaemo.blogspot.com/

Similar Threads

  1. problem with auto start && pre-install
    By Teddy_ in forum Symbian
    Replies: 1
    Last Post: 2009-02-26, 08:27
  2. Problem in 3rd ed with Embedded & AutoStart app
    By danipellex in forum Symbian
    Replies: 14
    Last Post: 2009-01-21, 15:39
  3. problem with send & recive in obex
    By masoud_bayat in forum Symbian
    Replies: 0
    Last Post: 2008-11-10, 09:41
  4. Embedded Flash Lite & Key events & problem with red button
    By EagleSW in forum [Archived] Flash Lite on Nokia Devices
    Replies: 3
    Last Post: 2008-01-11, 18:53
  5. problem with UIQ && code warrior
    By manishmpatil in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 0
    Last Post: 2005-12-23, 08:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •