utf8 confusion :(
Posted by: Russell England
Date: August 17, 2009 03:38AM

I'm coding a php program to translate the English in JoomFish into various languages, starting with Catalan. The program works okay on its own and displays the characters correctly when using:

meta http-equiv="Content-Type" content="text/html; charset=UTF-8
...
$trans = english_to_catalan($value);
$trans = fixEncoding($trans);
echo $trans
...
function fixEncoding($in_str)
{
$cur_encoding = mb_detect_encoding($in_str) ;
if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8"))
return $in_str;
else
return utf8_encode($in_str);
}


But when I use
$query = sprintf("UPDATE jos_jf_content set value = '%s', where id=%s limit 1", mysql_real_escape_string($trans), mysql_real_escape_string($id));

The values in the jos_jf_content table have the funny characters?
http://www.villamenorca.com/ca/inici.html

I've encoded the value to utf8, so I'm guessing its something to do with the mysql_real_escape_string() function - any ideas?

Many thanks

Russ

Joomla/PHP/MySql newbie since 11-June-08
Joomla Version 1.5.14 with legacy 1.0
MySql Server version: 5.1.30
MySQL charset: UTF-8 Unicode (utf8)
MySQL Connection Collation: utf8_unicode_ci
PHP Version 5.2.9
Apache 2.2.11

Options: ReplyQuote


Subject
Views
Written By
Posted
utf8 confusion :(
3211
August 17, 2009 03:38AM
2152
August 17, 2009 04:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.