Eric Guo's blog.cloud-mes.com

in HTML5, JavaScript, Ruby & Rails, Python, and Cloud MES!

How to Resolve Safari Download Filename Not Support Chinese

Permalink

Found from stackoverflow, which I think should including in send_data acturally….

def make_and_send_pdf(pdf_name, options = {})
options = { :disposition => 'attachment' }.merge(options)
file_name = "#{pdf_name}.pdf"
send_data(
make_pdf(options),
filename: ERB::Util.url_encode(file_name),
type: 'application/pdf',
disposition: "#{options[:disposition]}; filename*= UTF-8''#{ERB::Util.url_encode(file_name)}"
)
end

Comments