dhllabel: They must be encoded with CP1252 and not UTF-8
Fight with rails about the encoding of the label. First we render, then we encode to the closest we have for CP1252 and then we need to set response.body as returning the encoded string will not help us.
This commit is contained in:
parent
003ed11c14
commit
005e686187
|
@ -2,10 +2,15 @@ Admin::ShipmentsController.class_eval do
|
|||
def dhllabel
|
||||
load_shipment
|
||||
name = '%s_dhllabel.csv' % [@order.number]
|
||||
headers["Content-type"] = "text/plain"
|
||||
headers["Content-type"] = "text/plain; charset=iso-8859-15"
|
||||
headers["Cache-Control"] = "no-cache, max-age=0, must-revalidate"
|
||||
headers["Pragma"] = "no-cache"
|
||||
headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
|
||||
headers["Content-Disposition"] = "attachment; filename=\"%s\"" % name
|
||||
|
||||
# Try hard to render it as latin1
|
||||
res = render
|
||||
response.charset = 'iso-8859-15'
|
||||
response.body = Iconv.conv('iso-8859-15', 'utf-8', res)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue