Skip Menu |

This queue is for tickets about the Catalyst-Plugin-Unicode-Encoding CPAN distribution.

Report information
The Basics
Id: 75006
Status: resolved
Priority: 0/
Queue: Catalyst-Plugin-Unicode-Encoding

People
Owner: Nobody in particular
Requestors: vysokolov [...] gmail.com
Cc:
AdminCc:

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



Subject: Parsing content_type
In line 57 wrong Regex to parse charset. 57 if ($ct_enc && $ct_enc =~ /charset=(.*?)$/) { This regexp is not working on the content_type like 'text/csv; charset=iso-8859-1; header=present'. The correct regex should be: /charset=([^;]*?)/
Thanks for the bug report. This is fixed in the latest release.
On 2012-2月-14 火 13:22:31, Alex_v40 wrote: Show quoted text
> In line 57 wrong Regex to parse charset. > 57 if ($ct_enc && $ct_enc =~ /charset=(.*?)$/) { > > This regexp is not working on the content_type like 'text/csv; > charset=iso-8859-1; > header=present'. > > The correct regex should be: /charset=([^;]*?)/ >
Your regex doesn't work :( Try: use Test::Simple tests => 1; my $ct_enc = 'charset=iso-8859-1; header=present'; my $charset = ( $ct_env =~ /charset=([^;]*?)/ )[0]; ok $charset eq 'iso-8859-1'; # Failed Ryo
Subject: Re: [rt.cpan.org #75006] Parsing content_type
Date: Thu, 15 Mar 2012 10:23:58 -0400
To: bug-Catalyst-Plugin-Unicode-Encoding [...] rt.cpan.org
From: Aleksey Vysokolov <vysokolov [...] gmail.com>
perl -e '$ct_enc = "charset=iso-8859-1; header=present"; $ct_enc =~ /charset=([^;]+)/; print "$1\n";' On Thu, Mar 15, 2012 at 9:54 AM, Ryo Anazawa via RT < bug-Catalyst-Plugin-Unicode-Encoding@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=75006 > > > On 2012-2月-14 火 13:22:31, Alex_v40 wrote:
> > In line 57 wrong Regex to parse charset. > > 57 if ($ct_enc && $ct_enc =~ /charset=(.*?)$/) { > > > > This regexp is not working on the content_type like 'text/csv; > > charset=iso-8859-1; > > header=present'. > > > > The correct regex should be: /charset=([^;]*?)/ > >
> > Your regex doesn't work :( > > Try: > > use Test::Simple tests => 1; > my $ct_enc = 'charset=iso-8859-1; header=present'; > my $charset = ( $ct_env =~ /charset=([^;]*?)/ )[0]; > ok $charset eq 'iso-8859-1'; # Failed > > Ryo >
This is now properly fixed.
On Fri Mar 16 03:34:31 2012, BOBTFISH wrote: Show quoted text
> This is now properly fixed.
Thanks :)
And I've had another go, thanks!