This project is archived and is in readonly mode.

#2661 ✓resolved
Sava Chankov

Fix for send_data Content-Length header in Ruby 1.9

Reported by Sava Chankov | May 17th, 2009 @ 05:27 PM | in 2.3.4

In Ruby 1.9 String#size returns the actual character length, not size in bytes. send_data sets Content-Length header to length in characters so when sending multi-byte encoded text the file gets truncated. Example:

send_data("Кирилица", :type => text, :filename => 'utf8_text') # => the browser receives "Кири"

Here is a patch to fix this.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket


Referenced by