Subject: | UTF-8 and update_with_media |
There is problem with posting UTF-8 message via update_with_media
For example, if i have true UTF-8 string and trying to post it via
$twitter->update($item->message);
All looks fine.
But when i have code like
my $ua = Mojo::UserAgent->new;
my $picture = $ua->get($item->media_url)->res;
$twitter->update_with_media($item->message, [undef, undef, Content_Type
=> $picture->headers->content_type, Content => $picture->body]);
There is error HTTP::Message content must be bytes at /usr/local/share/
perl/5.12.4/HTTP/Request/Common.pm line 91
I fixed that via small hack
use Encode qw(_utf8_off);
my $ua = Mojo::UserAgent->new;
my $picture = $ua->get($item->media_url)->res;
my $message = $item->message;
_utf8_off($message);
$twitter->update_with_media($message, [undef, undef, Content_Type =>
$picture->headers->content_type, Content => $picture->body]);
As i understand update_with_media must work with utf8 without any hacks.