http
                                
                                 http copied to clipboard
                                
                                    http copied to clipboard
                            
                            
                            
                        incompatible character encodings: UTF-8 and ASCII-8BIT
Hi, i'm having some issues sending a request with form data. I'm getting this error on post call.
10: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/chainable.rb:27:in
post' 9: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/client.rb:30:inrequest' 8: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/client.rb:70:inperform' 7: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/connection.rb:76:insend_request' 6: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/request.rb:115:instream' 5: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/request/writer.rb:38:instream' 4: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/request/writer.rb:70:insend_request' 3: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/request/body.rb:37:ineach' 2: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/request/body.rb:37:incopy_stream' 1: from /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/request/body.rb:64:inwrite' /var/lib/gems/2.5.0/gems/http-3.3.0/lib/http/request/writer.rb:71:in `block in send_request': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)
I looked it doesnt crash when i remove a file from the form data.
This is my form data: removing file it appears to work correctly.
{:form=>{:_id=>"5a61b17f26ef95e96dd01cd5", :docType=>"DEFAULT", :name=>"a", :clientId=>"57e40c903f9eb69974c0249e", :description=>"a", :entity=>"56d361d7478dc883f1d63bea", :isVisible=>true, :isRequired=>false, :file=>#<HTTP::FormData::File:0x0000557712865f68 @io=#<File:/home/a/a/a/lib/upload/a-_OP-201800848_a_a_a_a.pdf>, @content_type="application/octet-stream", @filename="a-_OP-201800848_a_a_a_a.pdf">}} 
I don't know what to do now..
Ruby version: 2.5.0 and 2.4.4 has this bug Rails version 5.2.0 HTTP version 3.3.0
No updates?
Hm. That's definitely a bug. I'll be happy to look at once will have time (next week).
Could this bug be solved by always encoding the headers UTF-8 to ASCII-8BIT? I've done that in a fork and it seems to have solved this issue however don't fully understand the repercussions of that change.
      def send_request
        # It's important to send the request in a single write call when
        # possible in order to play nicely with Nagle's algorithm. Making
        # two writes in a row triggers a pathological case where Nagle is
        # expecting a third write that never happens.
        
        # Convert headers to binary string to prevent Encoding::CompatibilityError's
        data = join_headers.b