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);