You are here: issue with accents and mysql « PHP « IT news, forums, messages
issue with accents and mysql

Posted by Mario on 10/03/70 11:08

Hello,

please help me on the following issue.
please reply to chiari.hm@flashnet.it too.
(I asked for help on the php-db ml, but nobody replied)

I have hacked the following function:
function accents($text) {
global $export;
$search = array ( 'à', 'è', 'ì', 'ò' , 'ù');
$replace = array ( '\\`{a}', '\\`{e}', '\\`{i}', '\\`{o}', '\\`{u}');
$export = str_replace($search, $replace, $text);
return $export;
}

It works fine, as long as I feed it with a string:
accents('à') --> \`{a}

The issue is when I get 'à' from a mysql table.
I.e., for some record of a mysql table Table, let à the value of the
field Field, and say
$result = mysql_fetch_array($answer, MYSQL_BOTH),
where $answer= mysql_query(SELECT * FROM Table).


Now accents($result['Field']) returns à (instead of \`{a}).
Why? I have no idea.

Any hint is welcome.
Thanks a lot
mario

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация