title: how to Insert multiple columns using PQputCopyData
body: <p>I am trying to insert two columns using  <code>PQputCopyData</code> with following code. But once it checks for the final result it shows error invalid byte sequence for encoding <code>UTF8</code> and data is not getting inserted into the database.
  Both columns type is <code>character varying</code>. What am I doing wrong here ?</p>
  
  <pre><code>const char *buffer = "john,doe";
  
  PGresult *res;
  
  res=PQexec(conn,"COPY john FROM STDIN DELIMITER ',';");
  cout&lt;&lt;buffer;
  if(PQresultStatus(res) != PGRES_COPY_IN)
  {
      cout&lt;&lt;"copy in not ok";
  }
  else
  {
      if(PQputCopyData(conn,buffer,400) == 1)
      {
          if(PQputCopyEnd(conn,NULL) == 1)
          {
              PGresult *res = PQgetResult(conn);
              if(PQresultStatus(res) == PGRES_COMMAND_OK)
              {
  
              cout&lt;&lt;"done";
              }
                            else
                             {
              cout&lt;&lt;PQerrorMessage(conn);  Here I get the error invalid  byte sequence for encoding "UTF8"
                              }
          }
  
          else
          {
              cout&lt;&lt;PQerrorMessage(conn);
          }
      }
  }
  </code></pre>