Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange characters and encoding while using twitter API

I begun developing my own SIMPLE twitter client in my server (to bypass twitter.com blocking rule stablished by some dumbass at govt. office)

Please check this image so you can see the accented characters converted into weird symbol:

Screenshot of my app

It is being developed with this class Twitter PHP class by Tijs Verkoyen

This is my heading code, which is utf-8. Can anyone point me to a fix?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>

like image 757
Enrique Avatar asked Apr 21 '10 22:04

Enrique


2 Answers

try using the utf8_encode() function with PHP

like image 111
Patrick Gates Avatar answered Sep 22 '22 14:09

Patrick Gates


best is to avoid hassle if you could pass all your twitter texts(i.e. twitter API delivers JSON format too) using some sort of JSON format and pass those JSON into PHP 5 function

json_decode(jsonStr);

json_decode automatically converts to utf8 encoding which can save you from writing extra code for character encoding..

like image 35
M A Hossain Tonu Avatar answered Sep 21 '22 14:09

M A Hossain Tonu