user462990
user462990

Reputation: 5532

French accents not working with Twilio SMS

Twilio SMS messages work fine in English, but the French accents do not work. The accented characters are replaced by a ? sign. What can I do about this?

Upvotes: 3

Views: 1626

Answers (1)

user462990
user462990

Reputation: 5532

I found that converting the body to UTF-8 corrected this problem, and actually reduced the price by half. The difference is that I needed to utf8_encode the body, as shown below:

<?php
// Step 3: instantiate a new Twilio Rest Client
$client = new Services_Twilio($AccountSid, $AuthToken);
$phone = $_REQUEST['phone'];
$msg   = utf8_encode ( $_REQUEST['msg']);
$sms = $client->account->messages->sendMessage("xxx-xxx-xxxx", $phone, $msg);

Upvotes: 2

Related Questions