Subject: | Double encoded utf-8 strings |
Hi,
HTTP::Message content is always byte-encoded. Functions _put_response()
and _put_request() concatenate string with UTF-8 flag and without, which
makes double encoded utf-8 strings.
Sample patch attached.
--
ascent
Subject: | poe-filter-http-parser-patch.txt |
--- old-Parser.pm 2010-07-28 13:34:38.000000000 +0200
+++ Parser.pm 2010-07-28 13:15:58.000000000 +0200
@@ -6,6 +6,7 @@
use HTTP::Status qw(status_message RC_BAD_REQUEST RC_OK RC_LENGTH_REQUIRED);
use base 'POE::Filter';
use vars qw($VERSION);
+use Encode;
$VERSION = '1.02';
@@ -110,7 +111,7 @@
push @headers, $status_line;
push @headers, $_->headers_as_string("\x0D\x0A");
- push @raw, join("\x0D\x0A", @headers, "") . $_->content;
+ push @raw, encode_utf8(join("\x0D\x0A", @headers, "")) . $_->content;
}
\@raw;
@@ -135,7 +136,7 @@
push @headers, $req_line;
push @headers, $_->headers_as_string("\x0D\x0A");
- push @raw, join("\x0D\x0A", @headers, "") . $_->content;
+ push @raw, encode_utf8(join("\x0D\x0A", @headers, "")) . $_->content;
}
\@raw;