Problēma tāda, ka visi ieraksti, kuri tiek ierakstīti datubāzē izskatās šādi

Nesaprotu, kādu encode/decode jāliek, lai datus tabulā rādītu latviešu valodā. Dati tiek saņemti no Twitter search 

http://search.twitter.com/search.atom?q=  , kam vajadzētu būt UTF-8  formātā. 

Datubāzes Collation - utf8_general_ci , mēģināju arī ar Latvian, kaut kas nav. 


Kods

[code]

function getTweets($q, $limit=50)
{
$output = '';

// get the seach result
$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);

if ($response !== FALSE)
{
$xml = simplexml_load_string($response);

$output = '';
$tweets = 0;

for($i=0; $i<count($xml->entry); $i++)
{
$crtEntry = $xml->entry[$i];
$account = $crtEntry->author->uri;
$image = $crtEntry->link[1]->attributes()->href;
$tweet = $crtEntry->content;

// skip tweets containing banned words
$foundBadWord = false;
foreach ($this->badWords as $badWord)
{
if(stristr($tweet, $badWord) !== FALSE)
{
$foundBadWord = true;
break;
}
}

$tweet = str_replace('<a href=', '<a target="_blank" href=', $tweet);

// skip this tweet containing a banned word
if ($foundBadWord)
continue;

// don't process any more tweets if at the limit
if ($tweets==$limit)
break;
$tweets++;

// name is in this format "acountname (Real Name)"
preg_match($this->realNamePattern, $crtEntry->author->name, $matches);
$name = $matches[1];

// get the time passed between now and the time of tweet, don't allow for negative
// (future) values that may have occured if server time is wrong
$time = 'just now';
$secondsPassed = time() - strtotime($crtEntry->published);

if ($secondsPassed>0)
{
// see what interval are we in
for($j = count($this->intervalSeconds)-1; ($j >= 0); $j--)
{
$crtIntervalName = $this->intervalNames[$j];
$crtInterval = $this->intervalSeconds[$j];

if ($secondsPassed >= $crtInterval)
{
$value = floor($secondsPassed / $crtInterval);
if ($value > 1)
$crtIntervalName .= 's';

$time = $value . ' ' . $crtIntervalName . ' ago';

break;
}
}
}

[/code]