Skip Menu |

This queue is for tickets about the Mojo CPAN distribution.

Report information
The Basics
Id: 50305
Status: resolved
Priority: 0/
Queue: Mojo

People
Owner: Nobody in particular
Requestors: reidrac [...] usebox.net
Cc:
AdminCc:

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



CC: vti <vti [...] cpan.org>
Subject: Re: Problem with UTF-8
Date: Wed, 07 Oct 2009 21:50:23 +0200
To: bug-Mojo [...] rt.cpan.org
From: "Juan J." Martínez <reidrac [...] usebox.net>
Hello, I've found a problem by chance when I was developing a little application with Mojolicious. Seems that when you change the encoding by hand in your browser from UTF-8 to ISO-8859-1, and send a form... any regex over that form param will result in a "Malformed UTF-8 character (fatal)" error in Perl. This affects to Mojo modules too, such as Mojo::URL (that uses a regex to parse the URL). I've coded a little test Mojolicious::Lite app to test the problem. That's the result of following the steps shown in the application: $ ./utf.pl daemon Sat Oct 3 13:20:33 2009 info Mojo::Server::Daemon:56 [4902]: Server started (http://127.0.0.1:3000) Server available at http://127.0.0.1:3000. Sat Oct 3 13:20:40 2009 debug Mojolicious:72 [4902]: *** Request for "/test". *** Sat Oct 3 13:20:40 2009 debug MojoX::Dispatcher::Routes:56 [4902]: Dispatching callback. Sat Oct 3 13:20:40 2009 error MojoX::Dispatcher::Routes:71 [4902]: Error around line 105. 103: 104: # Official regex 105: my ($scheme, $authority, $path, $query, $fragment) = $url 106: =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?: \?([^#]*))?(?:#(.*))?|; 107: Malformed UTF-8 character (fatal) at lib/Mojo/URL.pm line 105. Sat Oct 3 13:20:40 2009 error Mojolicious::Renderer:60 [4902]: Template "exception.html.epl" missing or not readable. Sat Oct 3 13:20:40 2009 debug Mojolicious:123 [4902]: Request took 0.011075 seconds (90.293/s). My workaround (by now) is to eval the code to check if the param has any kind of malformed UTF-8 data. I hope the bug report it's clear enough (and I hope the cpan rt it's the correct place to file a bug). I've included vti in this mail because he helped me to spot the problem in first instance. Thank you! Regards, Juanjo -- jjm's home: http://www.usebox.net/jjm/ blackshell: http://blackshell.usebox.net/ ramble on: http://rambleon.usebox.net/

Message body is not shown because sender requested not to inline it.

Thanks for the report, this should be fixed on github now.