Change the charset attribute in the html header.
My whole application is serving in utf-8, only one page (xml) should return ISO-8859-1 page
<?xml version="1.0" encoding="ISO-8859-1"?>
Now how can I change the title attribute to serve ISO-8859-1.
Result
wget --save-headers http://79.125.52.185/kdb/jobs/jobs_ch
there is
HTTP/1.0 200 OK
...
Content-Length: 34899
Status: 200 OK
Content-Type: application/xml; charset=utf-8
...
<?xml version="1.0" encoding="ISO-8859-1"?>
<JOBS>
<INSERATE>
<INSERAT>
<ORGANISATIONID>10</ORGANISATIONID>
<INSERATID>1532</INSERATID>
<VORSPANN>Gemeinsam mit Ihrem Team sorgen Sie für Kundenservice
Where
für
it should be
für
and
Content-Type: application/xml; charset=utf-8
it should be
Content-Type: application/xml; charset=iso-8859-1
Power source
controller
def jobs_ch
@jobs = ...
render :action => 'jobs_ch', :layout => 'empty'
end
View
xml.instruct! :xml, :version=>"1.0" , :encoding => "ISO-8859-1"
xml.JOBS{
...
+2
source to share
3 answers
Oh, I feel your pain. I solved the same problem with an after_filter like this:
after_filter :this_xml_needs_to_be_in_cp1251
def this_xml_needs_to_be_in_cp1251
response.charset = 'cp1251'
response.body = Iconv.conv('cp1251//IGNORE//TRANSLIT','UTF-8',response.body)
end
I've edited the snippet to suit your needs, but I'm not sure about the encoding of Iconv's code.
+1
source to share
Maybe you should try to change your webserver encodings?
fe adding another encoding?
see http://intertwingly.net/blog/2004/09/23/Copy-and-Paste
or maybe this:
0
source to share