How to send slavic chars like č,ć,š,đ,ž to search api using php


#1

I am trying to make application that uses twitter search api. Since I am in Balcans and I need to search tweets from Serbia I need to include special serbian character. But when I put in search query some of those special characters like č,ć,š,đ,ž php magicly transforms it to something wierd and sends to twitter api, and twitter api does not return valid result of course. How to set up these characters in php? My code looks like this:

<?php
require('twitterclass.php');
$twitter = new twitter_class();
$q='domaći';
$output = $twitter->getTweets($q, 100);//this sends request in format 'http://search.twitter.com/search.atom?lang=en&rpp=100&src=typd&q='. urlencode($q), and parse result and returns output. Query looks almost the same as when I type in search box on twitter, but this query does not returns reasults if č,ć,đ,š or ž are in it. Otherwise it works fine
echo $output;
?>

Sending request code

$ch= curl_init($this->searchURL . urlencode($q));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
$response = curl_exec($ch);

My files are saved as UTF-8 files.