You are here: Foswiki>Tasks Web>Item9227 (09 Jul 2011, TimHeilig)Edit Attach

Item9227: viewfile defaults to charset ISO-8859-1 under CGI.pm

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Engine
Component:
Branches:
Reported By: TimHeilig
Waiting For: Main.TimHeilig
Last Change By: TimHeilig
-- TimHeilig - 30 Jun 2010

Doesn't seem to be an issue with my current installation, feel free to close.

-- TimHeilig - 09 Jul 2011
 

When using CGI.pm as the engine (with or without mod-perl) If a user attaches an html file that is encoded in utf-8, and viewfile is used to retrieve the attachment, viewfile will set the content type to text/html ; charset= iso-8859-1.

This is because CGI.pm defaults charset to iso-8859-1 if it is not set. If instead the charset is set to '', then apache will return the correct charset. I don't know if this will work for other servers as well.


We don't allow CGI.pm to use the default charset, if $Foswiki::cfg{CharSet} is defined.

My understanding is that if the headers say one thing and the content of the HTML page another, then the HTML page will win out in the browser. As long as either (1) your fosiwki charset is set to UTF8 or (2) the HTML includes a META encoding, then everything should be all right.

Can you provide a testcase that suggests otherwise?

-- CrawfordCurrie - 08 Sep 2010

ItemTemplate edit

Summary viewfile defaults to charset ISO-8859-1 under CGI.pm
ReportedBy TimHeilig
Codebase 1.0.9, trunk
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor TimHeilig
Checkins
TargetRelease n/a
ReleasedIn n/a
Topic revision: r4 - 09 Jul 2011, TimHeilig
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy