user13522: I'm working with esp8266.i am able to send text from webserver to arduino which is displayed on my 16*2 lcd display.but the problem is that when i send text including space i.e:john smith, the text show on my serial monitor and also in lcd  like that (john+smith)..the spaces i gave is converted into "+" sign..Can anyone suggest me how to overcome from that problem??
my code is given below:
  #include <SoftwareSerial.h>
  #include <LiquidCrystal.h>

 SoftwareSerial espSerial(2,3);

  LiquidCrystal lcd(12,11, 7, 6, 5, 4);

const bool printReply = true;
const char line[] = "-----\n\r";
int loopCount=0;

char html[50];
char command[20];
char reply[500]; 

char ipAddress [20];
char name[30];
int lenHtml = 0;
char temp[5];


void setup()
{
      Serial.begin(9600);
        lcd.begin(16,2);

      Serial.println("Start\r\n\r\n");

      lcd.print("WELCOME ");

      espSerial.begin(9600); 



      Serial.println("reset the module"); 
      espSerial.print("AT+RST\r\n");

      getReply( 2000 );



      Serial.println("Change to station mode"); 
      lcd.clear();
      lcd.print("station mode");
      espSerial.print("AT+CWMODE=1\r\n");
      getReply( 1500 );



      Serial.println("Connect to a network ");
      lcd.clear();
     lcd.print("connecting...");


      espSerial.print("AT+CWJAP=\"ESP_E61A83\"\r\n");
      getReply( 6000 );


      Serial.println("Get the ip address assigned by the router"); 
      espSerial.print("AT+CIFSR\r\n");
      getReply( 1000 );


      int len = strlen( reply ); 
      bool done=false;
      bool error = false;
      int pos = 0;
      while (!done)
      {
           if ( reply[pos] == 10) { done = true;} 
           pos++;
           if (pos > len) { done = true;  error = true;}
      }

      if (!error)
      {
            int buffpos = 0;
            done = false;
            while (!done)
            {
               if ( reply[pos] == 13 ) { done = true; }
               else { ipAddress[buffpos] = reply[pos];    buffpos++; pos++;   }
            }
            ipAddress[buffpos] = 0;
      }
      else { strcpy(ipAddress,"ERROR"); }




      Serial.println("Set for multiple connections"); 
      espSerial.print("AT+CIPMUX=1\r\n");
      getReply( 1500 );



      Serial.println("Start the server"); 
        lcd.clear();
      lcd.print("Server starts");
      espSerial.print("AT+CIPSERVER=1,80\r\n");
      getReply( 1500 );

      Serial.println("");



   lcd.clear();
      Serial.println("Waiting for page request");
      Serial.print("Connect to "); Serial.println(ipAddress);
      Serial.println("");
lcd.print("feed me more");
delay(1500);
        lcd.clear();

}



void loop()
{
      if(espSerial.available()) 



          bool foundIPD = false;
          for (int i=0; i<strlen(reply); i++)
          {
               if (  (reply[i]=='I') && (reply[i+1]=='P') && (reply[i+2]=='D')   ) { foundIPD = true;    }
          }


          if ( foundIPD  )  
          {

              loopCount++;

              int nameStartPos = 0;
              for (int i=0; i<strlen(reply); i++)
              {
                   if (!haveName)
                   {
                         if (  (reply[i]=='n') && (reply[i+1]=='a') && (reply[i+2]=='m') && (reply[i+3]=='e')  && (reply[i+4]=='=') ) 
                         { 
                             haveName = true;
                             nameStartPos = i+5;
                         }
                   }     
              }


              if (haveName)
              {
                    int tempPos = 0;
                    bool finishedCopying = false;
                    for (int i=nameStartPos; i<strlen(reply); i++)
                    {
                         if ( (reply[i]==' ') && !finishedCopying )  { finishedCopying = true;   } 
                         if ( !finishedCopying )                     { name[tempPos] = reply[i];   tempPos++; }
                    }              
                    name[tempPos] = 0;
              }

              if (haveName) { lcd.clear(); lcd.print("TEACHERS INFO..");Serial.print( "name = ");lcd.setCursor(0,1);Serial.println(name);lcd.print(name);Serial.println("");lcd.print(""); }



              else          { Serial.println( "no name entered");   Serial.println("");lcd.print(""); }






              strcpy(html,"<html><head></head><body>");
              strcpy(command,"AT+CIPSEND=0,25\r\n");
              espSerial.print(command);
              getReply( 2000 );          
              espSerial.print(html);
              getReply( 2000 );                      

              strcpy(html,"<h1 >TEACHERS INFORMATION WEBSERVER</h1>");
              strcpy(command,"AT+CIPSEND=0,40\r\n");
              espSerial.print(command);
              getReply( 2000 );         
              espSerial.print(html);
              getReply( 2000 );          

              strcpy(html,"<p>CREATED by jack</p>");
              strcpy(command,"AT+CIPSEND=0,31\r\n");
              espSerial.print(command);
              getReply( 2000 );          
              espSerial.print(html);
              getReply( 2000 );           

              strcpy(html,"<p> Teachers Request number ");
              itoa( loopCount, temp, 10);
              strcat(html,temp);
              strcat(html,"</p>");

              // need the length of html
              int lenHtml = strlen( html );

              strcpy(command,"AT+CIPSEND=0,");
              itoa( lenHtml, temp, 10);
              strcat(command, temp);
              strcat(command, "\r\n");
              espSerial.print(command);
              getReply( 2000 );          
              espSerial.print(html);
              getReply( 2000 );                       



             if (haveName)
             {

                  strcpy(html,"<p >TEACHER name is "); strcat(html, name ); strcat(html,"</p>");


                  lenHtml = strlen( html );
                  strcpy(command,"AT+CIPSEND=0,"); itoa( lenHtml, temp, 10); strcat(command, temp); strcat(command, "\r\n");
                  espSerial.print(command);
                  getReply( 2000 );          
                  espSerial.print(html);
                  getReply( 2000 );                           
             }


              strcpy(html,"<form action=\""); strcat(html, ipAddress); strcat(html, "\" method=\"GET\">"); strcat(command, "\r\n");

              lenHtml = strlen( html );
              itoa( lenHtml, temp, 10);
              strcpy(command,"AT+CIPSEND=0,"); 
              itoa( lenHtml, temp, 10); 
              strcat(command, temp);  
              strcat(command, "\r\n");

              espSerial.print(command);
              getReply( 2000 );          
              espSerial.print(html);
              getReply( 2000 );          

              strcpy(html,"Name:<br><input type=\"text\" name=\"name\">");
              strcpy(command,"AT+CIPSEND=0,40\r\n");
              espSerial.print(command);
              getReply( 2000 );         
              espSerial.print(html);
              getReply( 2000 );         


              strcpy(html,"<input type=\"submit\" value=\"Submit\"></form>");
              strcpy(command,"AT+CIPSEND=0,43\r\n");
              espSerial.print(command);
              getReply( 2000 );       
              espSerial.print(html);
              getReply( 2000 );

              strcpy(html,"</body></html>");
              strcpy(command,"AT+CIPSEND=0,14\r\n");
              espSerial.print(command);
              getReply( 2000 ); 
              espSerial.print(html);
              getReply( 2000 ); 


              espSerial.print( "AT+CIPCLOSE=0\r\n" );
              getReply( 1500 );            


              Serial.println("last getReply 1 ");
              getReply( 2500 );  

              Serial.println("last getReply 2 ");
              getReply( 2500 ); 



          } 
      } 


      delay (100);



}


void getReply(int wait)
{
    int tempPos = 0;
    long int time = millis();
    while( (time + wait) > millis())
    {
        while(espSerial.available())
        {
            char c = espSerial.read(); 
            if (tempPos < 500) { reply[tempPos] = c; tempPos++;   }
        }
        reply[tempPos] = 0;
    } 

    if (printReply) { Serial.println( reply );  Serial.println(line);     }
}


user8127: It is hard to understand what your code does. You said that arduino recives text from the server, but I see in the code is that the arduino is the http server, serving an html page with a form in it. 
That is also the reason you recieve spaces replaced with "+", the http request is url encoded. 
The problem with a search and replace solution of a "+" sign is that url encoding is more than a "+" sign. A space can also be encoded into %20 and there are several other characters that are being encoded as well.
What you will have to do is to implement a decoding function. It is not that hard but if you are lazy, there are plenty of C implementations available on the net. Here is a quick google search hit: https://gist.github.com/jmsaavedra/7964251

13522: <p>I'm working with esp8266.i am able to send text from webserver to arduino which is displayed on my 16*2 lcd display.but the problem is that when i send text including space i.e:john smith, the text show on my serial monitor and also in lcd  like that (john+smith)..the spaces i gave is converted into "+" sign..Can anyone suggest me how to overcome from that problem??
my code is given below:</p>

<pre><code>  #include &lt;SoftwareSerial.h&gt;
  #include &lt;LiquidCrystal.h&gt;

 SoftwareSerial espSerial(2,3);

  LiquidCrystal lcd(12,11, 7, 6, 5, 4);

const bool printReply = true;
const char line[] = "-----\n\r";
int loopCount=0;

char html[50];
char command[20];
char reply[500]; 

char ipAddress [20];
char name[30];
int lenHtml = 0;
char temp[5];


void setup()
{
      Serial.begin(9600);
        lcd.begin(16,2);

      Serial.println("Start\r\n\r\n");

      lcd.print("WELCOME ");

      espSerial.begin(9600); 



      Serial.println("reset the module"); 
      espSerial.print("AT+RST\r\n");

      getReply( 2000 );



      Serial.println("Change to station mode"); 
      lcd.clear();
      lcd.print("station mode");
      espSerial.print("AT+CWMODE=1\r\n");
      getReply( 1500 );



      Serial.println("Connect to a network ");
      lcd.clear();
     lcd.print("connecting...");


      espSerial.print("AT+CWJAP=\"ESP_E61A83\"\r\n");
      getReply( 6000 );


      Serial.println("Get the ip address assigned by the router"); 
      espSerial.print("AT+CIFSR\r\n");
      getReply( 1000 );


      int len = strlen( reply ); 
      bool done=false;
      bool error = false;
      int pos = 0;
      while (!done)
      {
           if ( reply[pos] == 10) { done = true;} 
           pos++;
           if (pos &gt; len) { done = true;  error = true;}
      }

      if (!error)
      {
            int buffpos = 0;
            done = false;
            while (!done)
            {
               if ( reply[pos] == 13 ) { done = true; }
               else { ipAddress[buffpos] = reply[pos];    buffpos++; pos++;   }
            }
            ipAddress[buffpos] = 0;
      }
      else { strcpy(ipAddress,"ERROR"); }




      Serial.println("Set for multiple connections"); 
      espSerial.print("AT+CIPMUX=1\r\n");
      getReply( 1500 );



      Serial.println("Start the server"); 
        lcd.clear();
      lcd.print("Server starts");
      espSerial.print("AT+CIPSERVER=1,80\r\n");
      getReply( 1500 );

      Serial.println("");



   lcd.clear();
      Serial.println("Waiting for page request");
      Serial.print("Connect to "); Serial.println(ipAddress);
      Serial.println("");
lcd.print("feed me more");
delay(1500);
        lcd.clear();

}



void loop()
{
      if(espSerial.available()) 



          bool foundIPD = false;
          for (int i=0; i&lt;strlen(reply); i++)
          {
               if (  (reply[i]=='I') &amp;&amp; (reply[i+1]=='P') &amp;&amp; (reply[i+2]=='D')   ) { foundIPD = true;    }
          }


          if ( foundIPD  )  
          {

              loopCount++;

              int nameStartPos = 0;
              for (int i=0; i&lt;strlen(reply); i++)
              {
                   if (!haveName)
                   {
                         if (  (reply[i]=='n') &amp;&amp; (reply[i+1]=='a') &amp;&amp; (reply[i+2]=='m') &amp;&amp; (reply[i+3]=='e')  &amp;&amp; (reply[i+4]=='=') ) 
                         { 
                             haveName = true;
                             nameStartPos = i+5;
                         }
                   }     
              }


              if (haveName)
              {
                    int tempPos = 0;
                    bool finishedCopying = false;
                    for (int i=nameStartPos; i&lt;strlen(reply); i++)
                    {
                         if ( (reply[i]==' ') &amp;&amp; !finishedCopying )  { finishedCopying = true;   } 
                         if ( !finishedCopying )                     { name[tempPos] = reply[i];   tempPos++; }
                    }              
                    name[tempPos] = 0;
              }

              if (haveName) { lcd.clear(); lcd.print("TEACHERS INFO..");Serial.print( "name = ");lcd.setCursor(0,1);Serial.println(name);lcd.print(name);Serial.println("");lcd.print(""); }



              else          { Serial.println( "no name entered");   Serial.println("");lcd.print(""); }






              strcpy(html,"&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;");
              strcpy(command,"AT+CIPSEND=0,25\r\n");
              espSerial.print(command);
              getReply( 2000 );          
              espSerial.print(html);
              getReply( 2000 );                      

              strcpy(html,"&lt;h1 &gt;TEACHERS INFORMATION WEBSERVER&lt;/h1&gt;");
              strcpy(command,"AT+CIPSEND=0,40\r\n");
              espSerial.print(command);
              getReply( 2000 );         
              espSerial.print(html);
              getReply( 2000 );          

              strcpy(html,"&lt;p&gt;CREATED by jack&lt;/p&gt;");
              strcpy(command,"AT+CIPSEND=0,31\r\n");
              espSerial.print(command);
              getReply( 2000 );          
              espSerial.print(html);
              getReply( 2000 );           

              strcpy(html,"&lt;p&gt; Teachers Request number ");
              itoa( loopCount, temp, 10);
              strcat(html,temp);
              strcat(html,"&lt;/p&gt;");

              // need the length of html
              int lenHtml = strlen( html );

              strcpy(command,"AT+CIPSEND=0,");
              itoa( lenHtml, temp, 10);
              strcat(command, temp);
              strcat(command, "\r\n");
              espSerial.print(command);
              getReply( 2000 );          
              espSerial.print(html);
              getReply( 2000 );                       



             if (haveName)
             {

                  strcpy(html,"&lt;p &gt;TEACHER name is "); strcat(html, name ); strcat(html,"&lt;/p&gt;");


                  lenHtml = strlen( html );
                  strcpy(command,"AT+CIPSEND=0,"); itoa( lenHtml, temp, 10); strcat(command, temp); strcat(command, "\r\n");
                  espSerial.print(command);
                  getReply( 2000 );          
                  espSerial.print(html);
                  getReply( 2000 );                           
             }


              strcpy(html,"&lt;form action=\""); strcat(html, ipAddress); strcat(html, "\" method=\"GET\"&gt;"); strcat(command, "\r\n");

              lenHtml = strlen( html );
              itoa( lenHtml, temp, 10);
              strcpy(command,"AT+CIPSEND=0,"); 
              itoa( lenHtml, temp, 10); 
              strcat(command, temp);  
              strcat(command, "\r\n");

              espSerial.print(command);
              getReply( 2000 );          
              espSerial.print(html);
              getReply( 2000 );          

              strcpy(html,"Name:&lt;br&gt;&lt;input type=\"text\" name=\"name\"&gt;");
              strcpy(command,"AT+CIPSEND=0,40\r\n");
              espSerial.print(command);
              getReply( 2000 );         
              espSerial.print(html);
              getReply( 2000 );         


              strcpy(html,"&lt;input type=\"submit\" value=\"Submit\"&gt;&lt;/form&gt;");
              strcpy(command,"AT+CIPSEND=0,43\r\n");
              espSerial.print(command);
              getReply( 2000 );       
              espSerial.print(html);
              getReply( 2000 );

              strcpy(html,"&lt;/body&gt;&lt;/html&gt;");
              strcpy(command,"AT+CIPSEND=0,14\r\n");
              espSerial.print(command);
              getReply( 2000 ); 
              espSerial.print(html);
              getReply( 2000 ); 


              espSerial.print( "AT+CIPCLOSE=0\r\n" );
              getReply( 1500 );            


              Serial.println("last getReply 1 ");
              getReply( 2500 );  

              Serial.println("last getReply 2 ");
              getReply( 2500 ); 



          } 
      } 


      delay (100);



}


void getReply(int wait)
{
    int tempPos = 0;
    long int time = millis();
    while( (time + wait) &gt; millis())
    {
        while(espSerial.available())
        {
            char c = espSerial.read(); 
            if (tempPos &lt; 500) { reply[tempPos] = c; tempPos++;   }
        }
        reply[tempPos] = 0;
    } 

    if (printReply) { Serial.println( reply );  Serial.println(line);     }
}
</code></pre>
 8127: <p>It is hard to understand what your code does. You said that arduino recives text from the server, but I see in the code is that the arduino <strong>is</strong> the http server, serving an html page with a form in it. </p>

<p>That is also the reason you recieve spaces replaced with "+", the http request is <a href="https://en.wikipedia.org/wiki/POST_(HTTP)#Use_for_submitting_web_forms" rel="nofollow"><strong>url encoded</strong></a>. </p>

<p>The problem with a search and replace solution of a "+" sign is that url encoding is more than a "+" sign. A space can also be encoded into %20 and there are several other characters that are being encoded as well.</p>

<p>What you will have to do is to implement a <strong>decoding</strong> function. It is not that hard but if you are lazy, there are plenty of C implementations available on the net. Here is a quick google search hit: <a href="https://gist.github.com/jmsaavedra/7964251" rel="nofollow">https://gist.github.com/jmsaavedra/7964251</a></p>
