Thanks for your reply. But the function that I've written, converts a code to a character. for example if input is u0631 the output will be: ARABIC LETTER REH "ر" But I think that use of this json_decode() is a little nonsense! I didn't find a straightforward function to do this ,though I've searched a lot. On Mon, Dec 19, 2011 at 11:51 AM, Francisco M. Marzoa Alonso < francisco@xxxxxxxxxx> wrote: > Hello, > > Can you please provide an example of real input and the output expected? > > I'm not sure about what you want to do. Anyway, for converting utf-8 > characters into plain ASCII "equivalents" chars, you can use iconv > "translit" feature like: > > $rtn = iconv ('UTF-8', 'ASCII//TRANSLIT', $string); > > You may need to set locale before using setlocale. For Spanish strings I > use this code: > > setlocale (LC_ALL, 'es_ES.UTF-8'); > $rtn = iconv ('UTF-8', 'ASCII//TRANSLIT', $string); > > If I use for example this as $string: > > 'ביםףתס' > > I will get this as $rtn at return: > > 'aeioun' > > Regards, > > > > > > On 18/12/11 10:33, Ali Asghar Toraby Parizy wrote: > > Hi. > > As I was writing a php code last week, I struggled with a function that > was > > supposed to convert Unicode code to a character. At last I wrote this > > function: > > > > function unicodeToChr($param) { > > > > $a =json_decode('{"t":"'.$param.'"}'); > > > > return $a->t; > > } > > > > > > In this function the $param should be something like '\u0627'. I want to > > know if it's acceptable to use this function? Does exist any better > > solution to do that? > > Thanks. > > > >