PacketFence
Bug Tracking System

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001287PacketFencecaptive portalpublic2011-09-28 13:542011-10-24 20:17
Reporterobilodeau 
Assigned Tofrancis 
PrioritynormalSeverityminorReproducibilityrandom
StatusclosedResolutionfixed 
PlatformLinuxOSOS Version
Product Version 
Target Version3.0.2Fixed in Version3.0.2 
Summary0001287: Unreliable encoding behavior messes up with translations
DescriptionDefault apache and perl CGI charset is set to ISO-8859-1. It works most of the time but we faced a situation where it didn't.

Can be fixed in two stages:
--- pf/conf/httpd.conf.apache22 a261d69b389f0d9a00a66cd82fdbca52f12f37c3
+++ pf/conf/httpd.conf.apache22 8a42bf3e66bc88774fd73677c32499120b567451
@@ -33,8 +33,7 @@ ErrorLog %%install_dir%%/logs/error_log
 LogFormat "%h %l %u %t \"%r\" %>s %b" common
 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" 
combined
 ErrorLog %%install_dir%%/logs/error_log
-AddDefaultCharset ISO-8859-1
-AddCharset ISO-8859-1  .iso8859-1  .latin1
+AddDefaultCharset UTF-8
 
 AddHandler cgi-script .cgi
 TypesConfig /etc/mime.types

and change all the instances of print $cgi->header(...
@@ -348,7 +348,7 @@ sub generate_error_page {
     }
 
     my $cookie = $cgi->cookie( CGISESSID => $session->id );
-    print $cgi->header( -cookie => $cookie );
+    print $cgi->header( -cookie => $cookie, -charset => 'utf-8' );
 
     my $template = Template->new( { INCLUDE_PATH => [$CAPTIVE_PORTAL{'TEMPLATE_DIR'}], } );
     $template->process( "error.html", $vars, $r );
TagsNo tags attached.
fixed in git revision
fixed in mtn revision
Attached Files

- Relationships

-  Notes
(0002303)
francis (administrator)
2011-09-29 13:36

Requires yet another stage :

--- pf/lib/pf/web.pm 0b6066e745fb875d27a1e0ea8d93e2d72d752ccb
+++ pf/lib/pf/web.pm 8e5a95336def8f7ee8738fd138203880f2026d34
@@ -66,7 +66,7 @@ sub i18n {
 sub i18n {
     my $msgid = shift;
 
- return decode_utf8(gettext($msgid));
+ return gettext($msgid);
 }
 
 sub ni18n {
@@ -74,7 +74,7 @@ sub ni18n {
     my $plural = shift;
     my $category = shift;
 
- return decode_utf8(ngettext($singular, $plural, $category));
+ return ngettext($singular, $plural, $category);
 }

Also, instead of changing all the calls to header, we could set the header when creating the cgi object. For example :

--- pf/html/captive-portal/guest-selfregistration.cgi 91dccf02668263b7953a85f1e06e0e8fda88711a
+++ pf/html/captive-portal/guest-selfregistration.cgi 1c338dcf019ddf607dbebc06d6d6ee8c4a55766b
@@ -36,6 +36,7 @@ my $cgi = new CGI;
 Log::Log4perl::MDC->put('tid', 0);
 
 my $cgi = new CGI;
+$cgi->charset('utf-8');
 my $session = new CGI::Session(undef, $cgi, {Directory=>'/tmp'});
 
 my $result;
(0002304)
francis (administrator)
2011-09-29 14:00

Fixed and pushed to org.packetfence.3_0 (revision f2ac1c2baa04bde7d43bfaeeb884b3fa4b84d5ea).
(0002388)
obilodeau (reporter)
2011-10-24 20:15

fix released in 3.0.2

- Issue History
Date Modified Username Field Change
2011-09-28 13:54 obilodeau New Issue
2011-09-29 13:36 francis Note Added: 0002303
2011-09-29 14:00 francis Note Added: 0002304
2011-09-29 14:00 francis Status new => resolved
2011-09-29 14:00 francis Resolution open => fixed
2011-09-29 14:00 francis Assigned To => francis
2011-09-29 14:00 francis Fixed in Version => +1
2011-10-24 20:15 obilodeau Target Version +1 => 3.0.2
2011-10-24 20:15 obilodeau Note Added: 0002388
2011-10-24 20:16 obilodeau Status resolved => closed
2011-10-24 20:17 obilodeau Fixed in Version +1 => 3.0.2


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker