How can i use special characters on PHP applications


#1

Hi everybody,

I use OAuth and my codes :

$status = $twitterObj->post_statusesUpdate(array(‘status’ => ‘Ömer’));
print_r($status->response);

I have an error it shows Could not authenticate with OAuth.

but If it doesn’t include special or turkish characters, it will be okay it will send message…

How can i solve this problem…


#2

Me too facing the same problem with direct message posting. The problem is with multibyte characters.


#3

You have to UTF-8 the tweet, and first clean it.

$tweetout = utf8_encode (stripslashes($tweetout)); $tweet = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET); $response = $tweet->post('statuses/update', array('status' => $tweetout));

Solved the same problem for me.

To see how it works:

$a=‘This is “the” tweet from hell’s php’;

echo $a.’
’;

echo ‘URL Encode = ‘.urlencode($a).’
’;
echo ‘Raw = ‘.rawurlencode($a).’
’;
echo ‘UTF-8 = ‘.utf8_encode ($a).’
’;