This queue is for tickets about the SMS-MessageBird CPAN distribution.

Report information
The Basics
Id:
127966
Status:
resolved
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
kparkhurst [...] intellisurvey.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Unicode Support Bug (SMS::MessageBird 0.03)
Date: Sat, 8 Dec 2018 02:00:35 -0800
To: bug-SMS-MessageBird@rt.cpan.org
From: Kaitlyn Parkhurst <kparkhurst@intellisurvey.com>
Hello,

I'm using SMS::MessageBird and have run into an issue with sending messages with unicode.

I attempted to send the following message: "I am unicode ūüėĀ !"

107     my $res = $sms->sms->send(
108         recipients => $message->phone_number,
109¬† ¬† ¬† ¬† ¬†body¬† ¬† ¬† ¬†=> "I am unicode ūüėĀ !",
110         originator => $origin_number->phone_number,
111         datacoding => ( $type eq 'gsm' ? 'plain' : 'unicode' ),
112     );

I got the following error:

HTTP::Message content must be bytes at /usr/share/perl5/vendor_perl/HTTP/Request/Common.pm line 94.

After some digging, I made the following patch for SMS/MessageBird/API.pm. and it seems to have corrected the issue:

7a8
> use Encode qw( encode_utf8 );
147,148c148,149
<         $request_params{'Content-Type'} = 'application/json',
<         $request_params{Content} = $content_payload;
---
>         $request_params{'Content-Type'} = 'application/json;charset=utf-8',
>         $request_params{Content} = encode_utf8($content_payload);

Thank you for your work on SMS::MessageBird, it's been wonderful to use.


Firstly, apologies for the delay, I must have missed this when it was originally submitted. Sorry. I've reviewed the patch, and applied it. Thank you for your contribution! Release 0.04, which includes this, has just gone out to CPAN: https://metacpan.org/release/JAMESR/SMS-MessageBird-0.04 Thanks again, JAMESR


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.