title: File upload fails, when posting with Indy and filename contains Greek characters
body: <p>I am trying to implement a <code>POST</code> to a web service. I need to send a file whose type is variable (<code>.docx</code>, <code>.pdf</code>, <code>.txt</code>) along with a JSON formatted string.</p>
  
  <p>I have manage to post files successfully with code similar to the following:</p>
  
  <pre><code>procedure DoRequest;
  var
    Http: TIdHTTP;
    Params: TIdMultipartFormDataStream;
    RequestStream, ResponseStream: TStringStream;
    JRequest, JResponse: TJSONObject;
    url: string;
  begin
    url := 'some_custom_service'
  
    JRequest := TJSONObject.Create;
    JResponse := TJSONObject.Create;
    try
      JRequest.AddPair('Pair1', 'Value1');
      JRequest.AddPair('Pair2', 'Value2');
      JRequest.AddPair('Pair3', 'Value3');
  
      Http := TIdHTTP.Create(nil);           
      ResponseStream := TStringStream.Create;
      RequestStream := TStringStream.Create(UTF8Encode(JRequest.ToString));
      try   
        Params := TIdMultipartFormDataStream.Create;
        Params.AddFile('File', ceFileName.Text, '').ContentTransfer := '';
        Params.AddFormField('Json', 'application/json', '', RequestStream);
  
        Http.Post(url, Params, ResponseStream);
        JResponse := TJSONObject.ParseJSONValue(ResponseStream.DataString) as TJSONObject;
      finally    
        RequestStream.Free;
        ResponseStream.Free;
        Params.Free;
        Http.Free;
      end;
    finally
      JRequest.Free;
      JResponse.Free;
    end;
  end;
  </code></pre>
  
  <p>The problem appears when I try to send a file that contains Greek characters and spaces in the filename. Sometimes it fails and sometimes it succeeds.</p>
  
  <p>After a lot of research, I notice that the <code>POST</code> header is encoded by Indy's <code>TIdFormDataField</code> class using the <code>EncodeHeader()</code> function.  When the post fails, the encoded filename in the header is split, compared to the successful post where is not split. </p>
  
  <p>For example : </p>
  
  <ul>
  <li><code>Επιστολή εκπαιδευτικο.docx</code> is encoded as <code>=?UTF-8?B?zpXPgM65z4PPhM6/zrvOriDOtc66z4DOsc65zrTOtc+Fz4TOuc66zr8uZG9j?='#$D#$A' =?UTF-8?B?eA==?=</code>, which fails.</li>
  <li><code>Επιστολή εκπαιδευτικ.docx</code> is encoded as 
  <code>=?UTF-8?B?zpXPgM65z4PPhM6/zrvOriDOtc66z4DOsc65zrTOtc+Fz4TOuc66LmRvY3g=?=</code>,  which succeeds.</li>
  <li><code>Επιστολή εκπαιδευτικ .docx</code> is encoded as 
  <code>=?UTF-8?B?zpXPgM65z4PPhM6/zrvOriDOtc66z4DOsc65zrTOtc+Fz4TOuc66?= .docx</code>, which fails.</li>
  </ul>
  
  <p>I have tried to change the encoding of the filename, the <code>AContentType</code> of the <code>AddFile()</code> procedure, and the <code>ContentTransfer</code>, but none of those change the behavior, and I still get errors when the encoded filename is split.</p>
  
  <p>Is this some kind of bug, or am I missing something?</p>
  
  <p>My code works for every case except those I described above.</p>
  
  <p>I am using Delphi XE3 with Indy10.</p>