[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to move to UTF-8: stattrans.pl



On Thu, Jul 30, 2009 at 01:05:40PM +0200, Simon Paillard wrote:
> On Wed, Jul 29, 2009 at 06:27:02PM +0200, Frans Pop wrote:
> > > Moving the website to UTF-8 would allow to get rid of such issues.
> > 
> > FYI, I've just converted the Dutch translation to UTF-8.
> 
[..] 
> Do you see something else ?

The charset written in stats pages is currently harcoded to iso8859-1,
which breaks acents in maintainer names (read form translation-check
header).

Here is a little patch applied against stattrans.pl that advertise the
same charset as the wml one.

The script on i18n.debian.net that sends notification to translators
maybe affected as well depending on the translator.db.pl encoding.
(not yet checked).

-- 
Simon Paillard
Index: stattrans.pl
===================================================================
RCS file: /cvs/webwml/webwml/stattrans.pl,v
retrieving revision 1.88
diff -u -r1.88 stattrans.pl
--- stattrans.pl	2 Jun 2009 21:46:10 -0000	1.88
+++ stattrans.pl	2 Aug 2009 17:15:18 -0000
@@ -288,6 +288,15 @@
     foreach $l (@processed_langs) {
         print "$l.html " if ($config{'verbose'});
 
+		$charset{$lang};
+		open (wmlrc,"$opt_w/$lang/.wmlrc") ;
+		while (<wmlrc>) {
+			if ( /^-D CHARSET=(.*)$/ ) { 
+				$charset{$lang} = $1;
+			}
+		}		
+		close wmlrc ;
+
         $t_body = $u_body = $ui_body = $un_body = $uu_body = $o_body = "";
         $translated{$lang} = $outdated{$lang} = $untranslated{$lang} = 0;
 
@@ -405,7 +414,7 @@
 	    printf HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\";>\n";
             # printf HTML "<html><head><title>%s: %s</title></head><body bgcolor=\"#ffffff\">\n", $config{'title'}, ucfirst $lang;
             printf HTML "<html>\n<head>\n";
-	    printf HTML "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
+	    printf HTML "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=$charset{$lang}\">\n";
 	    printf HTML "  <title>%s: %s</title>\n", $config{'title'}, ucfirst $lang;
 	    print HTML " <link href=\"../../../debian.css\" rel=\"stylesheet\" type=\"text/css\">";
 	    print HTML "</head>\n<body>\n";

Reply to: