Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 62907
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: fabrice.metge [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [IMPROVE] Adding 'charset' attribut for script tag
[IMPROVE] Add attribut 'charset' in script tag. Proposition Code for CGI.pm : sub _script { my ($self,$script) = @_; my (@result); my (@scripts) = ref($script) eq 'ARRAY' ? @$script : ($script); for $script (@scripts) { my($src,$code,$language,$charset); if (ref($script)) { # script is a hash ($src,$code,$type,$charset) = rearrange(['SRC','CODE',['LANGUAGE','TYPE'],'CHARSET'], '-foo'=>'bar', # a trick to allow the '-' to be omitted ref($script) eq 'ARRAY' ? @$script : %$script); $type ||= 'text/javascript'; unless ($type =~ m!\w+/\w+!) { $type =~ s/[\d.]+$//; $type = "text/$type"; } } else { ($src,$code,$type,$charset) = ('',$script, 'text/javascript', ''); } my $comment = '//'; # javascript by default $comment = '#' if $type=~/perl|tcl/i; $comment = "'" if $type=~/vbscript/i; my ($cdata_start,$cdata_end); if ($XHTML) { $cdata_start = "$comment<![CDATA[\n"; $cdata_end .= "\n$comment]]>"; } else { $cdata_start = "\n<!-- Hide script\n"; $cdata_end = $comment; $cdata_end .= " End script hiding -->\n"; } my(@satts); push(@satts,'src'=>$src) if $src; push(@satts,'type'=>$type); push(@satts,'charset'=>$charset) if ($src && $charset); $code = $cdata_start . $code . $cdata_end if defined $code; push(@result,$self->script({@satts},$code || '')); } @result; }
Subject: Re: [rt.cpan.org #62907] [IMPROVE] Adding 'charset' attribut for script tag
Date: Wed, 10 Nov 2010 16:42:25 -0500
To: bug-CGI [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
On 11/10/2010 04:41 PM, metge via RT wrote: Show quoted text
> Wed Nov 10 16:41:04 2010: Request 62907 was acted upon. > Transaction: Ticket created by fabrice.metge > Queue: CGI > Subject: [IMPROVE] Adding 'charset' attribut for script tag > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: fabrice.metge@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=62907 > > > > [IMPROVE] Add attribut 'charset' in script tag.
Could you say more about this? A "diff" against the latest version would help, as would be some automated tests for the proposed change. Mark
From: fabrice.metge [...] gmail.com
Le Mer 10 Nov 2010 16:42:34, mark@summersault.com a écrit : Show quoted text
> On 11/10/2010 04:41 PM, metge via RT wrote:
> > Wed Nov 10 16:41:04 2010: Request 62907 was acted upon. > > Transaction: Ticket created by fabrice.metge > > Queue: CGI > > Subject: [IMPROVE] Adding 'charset' attribut for script tag > > Broken in: (no value) > > Severity: (no value) > > Owner: Nobody > > Requestors: fabrice.metge@gmail.com > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=62907 > > > > > > > [IMPROVE] Add attribut 'charset' in script tag.
> > Could you say more about this? A "diff" against the latest version > would help, as would be some automated tests for the proposed change. > > Mark
With the last (version '3.50') and older, we cannot specified a charset for a src code in script tag -script=>[{-src=> 'menu.js'}, {-src=> 'table.js?1.0', -charset=>'utf-8'} ] With my proposal, the previous code generate the following html code : <script src="menu.js" type="text/javascript"></script> <script src="table.js?1.0" charset="utf-8" type="text/javascript"></script> Usefull for having src code in utf-8 for example http://www.w3.org/TR/REC-html40/interact/scripts.html#edef-SCRIPT I'm sorry, it's the first time that I post something on cpan. But I'm using CGI lib since many years, just a little contribution.
Subject: Re: [rt.cpan.org #62907] [IMPROVE] Adding 'charset' attribut for script tag
Date: Thu, 11 Nov 2010 00:00:33 +0100
To: bug-CGI [...] rt.cpan.org
From: Fabrice Metge <fabrice.metge [...] gmail.com>
see attachement file. "diff" against the latest version and example code, I can't do more. Fabrice Metge 2010/11/10 mark@summersault.com via RT <bug-CGI@rt.cpan.org> Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=62907 > > > On 11/10/2010 04:41 PM, metge via RT wrote:
> > Wed Nov 10 16:41:04 2010: Request 62907 was acted upon. > > Transaction: Ticket created by fabrice.metge > > Queue: CGI > > Subject: [IMPROVE] Adding 'charset' attribut for script tag > > Broken in: (no value) > > Severity: (no value) > > Owner: Nobody > > Requestors: fabrice.metge@gmail.com > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=62907 > > > > > > > [IMPROVE] Add attribut 'charset' in script tag.
> > Could you say more about this? A "diff" against the latest version > would help, as would be some automated tests for the proposed change. > > Mark > >
-- Fabrice Metge (033)606524041
Download CGI.README.FME
application/octet-stream 7.2k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #62907] [IMPROVE] Adding 'charset' attribut for script tag
Date: Thu, 11 Nov 2010 10:51:47 -0500
To: bug-CGI [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Thanks for the clarifications. We'll review it. Mark
Thanks, this has been added to our git repo now.
Subject: patch released for CGI.pm
Thanks for the bug report. A patch for it appeared in 3.51, if not sooner. Resolving. Mark