Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 17249
Status: rejected
Priority: 0/
Queue: libwww-perl

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

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



Subject: Error wide character in syswrite while posting multi-byte UTF-8 data with content-type form-data
Perl version -- 5.8.6 libwww version -- 5.803 The following code snippet gives an error "wide character in syswrite". The error comes only when Multi-Byte UTf-8 encoded characters are used. The code works perfectly for Ascii UTF-8 characters and native language charsets. Looks like there socket syswrite in lwp::protocol::http.pm is not able to handle utf-8 characters. With form-data, I cannot specify that charset is utf-8. Let me know the work around for the same. Please let me know if there is a word around for the same. my $http_request = HTTP::Request::Common::POST $self->{URL}, Content_Type => 'form- data', Content => [ SUBJECT => $self->{Subject}, BODY => $message, ]; my $agent = new LWP::UserAgent; my $timeout = $self->{Timeout}; $timeout = $ENV{TIMEOUT} unless defined($timeout); $timeout = 120 unless defined($timeout); # Apply timeout throttle $timeout = $ENV{MAX_TIMEOUT} if ($timeout > $ENV{MAX_TIMEOUT}); trace TRACE_ACTION,"Client timeout is $timeout"; $agent->timeout($timeout); my $http_response = $agent->request($http_request);
From: tony [...] tnc.hk
Hi, it's been 2 years already. Has anybody has at least a work around for this?
The "workaround" is to encode your data before inserting it into an HTTP::Request object. I want the LWP protocol modules to be able to assume that the HTTP::Request content is bytes. This is also documented. You should not break that invariant and assume things will work. On the other hand it seems appropriate for the HTTP::Request::Common functions to help out with the encoding somehow.