Strange characters and encoding when using twitter API

I started developing my own SIMPLE twitter client on my server (to get around the twitter.com blocking rule set by some dumb guy in the govt office.)

Please check this image so that you can see accented characters converted to a strange character :

Screenshots of my app

It is developed using this Twitter class. PHP class from Tijs Verkoyen

This is my header code, which is utf-8. Can someone 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>

+6
api php special-characters character-encoding twitter
source share
2 answers

try using utf8_encode() function with php

+6
source share

the best way to avoid problems is if you can pass all your twitter texts (i.e. twitter API also provides JSON format) using some kind of JSON format and passing these JSON functions to PHP 5

 json_decode(jsonStr); 

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

+1
source share

All Articles