Hi,
I have some problem. My page - template character encoding is set to UTF-8. During the registration i show my custom registration form (is just show some additional page than a default form nothing special ) and character is show OK and evrything is work fine.
But when I go to edit profile and even if I don’t change the fields where is UTF-8 character- after saving form - this character get some WRONG coding ... HELP me ...
So the problem is that the coding is not set the same on registration process and on update profile process.... Can somebody help me
Thanks
hi
as I see the problem is in weblogipe.class
when function is get from custom table data for user in order to upload them ....
somhow get the wrong character setings
"...if (!empty($this->CustomFields) && $this->CustomFields !== ’’)
{
$checkForExtended = "SELECT * FROM ".$this->CustomTable." WHERE `internalKey` = ’".$internalKey."’";
$isExtended = $modx->db->query($checkForExtended);
$extendedRows = $modx->db->getRow($isExtended);
if (!empty($extendedRows))
{
$extendedFieldValues = array();
foreach ($this->CustomFields as $field)
{
// CREDIT: Mike Reid (aka Pixelchutes) for the string escape code.
$extendedFieldValues[] = " `".$field."` = ’".$modx->db->escape(stripslashes(htmlentities(trim($_POST[$field]), ENT_QUOTES)))."’"; ----- MAYBE THIS IS THE COUSE, i dont know (this is ony that diferent from insert taht is work ok)
}
$this->OnBeforeWebSaveUser($generalElementsUpdate, $extendedFieldValues);
$extendedUserAttr = "UPDATE ".$this->CustomTable." SET".implode(’, ’, $extendedFieldValues)." WHERE `internalkey` = ’".$internalKey."’";
}
else
{
$extendedFieldValues = array();
foreach ($this->CustomFields as $field)
{
// CREDIT: Mike Reid (aka Pixelchutes) for the string escape code.
$extendedFieldValues[$field] = $modx->db->escape(stripslashes(htmlentities(trim($_POST[$field]), ENT_QUOTES)));
}
$this->OnBeforeWebSaveUser($generalElementsUpdate, $extendedFieldValues);
$extendedFieldValues = implode("’, ’", $extendedFieldValues);
$extendedFields = implode(’`, `’, $this->CustomFields);
$extendedUserAttr = "INSERT INTO ".$this->CustomTable." (`internalKey`, `".$extendedFields."`) VALUES (’".$internalKey."’, ’".$extendedFieldValues."’)";
}
}
// Prepare the query for General Elements
$generalElementsSQL = "UPDATE ".$web_user_attributes." SET ".implode(’, ’, $generalElementsUpdate)." WHERE `internalkey` = ’".$internalKey."’";
....."
also I read about that i need to set
mysql_query( ’set names utf8’ );
but I dont know where to put that
HELP me ...
Yes , the problem was in row
"...... $extendedFieldValues[] = " `".$field."` = ’".$modx->db->escape(stripslashes(htmlentities(trim($_POST[$field]), ENT_QUOTES)))....."
htmlentities function has the 3 parametars and the last one is char sething whena i put
escape(stripslashes(htmlentities(trim($_POST[$field]), ENT_QUOTES,"UTF-8")))
it work fine
Nope, you also need to comment out line 1222, like so:
[tt]// $value = html_entity_decode($value);[/tt]
Do the same with lines 1326:
[tt]// $setting = html_entity_decode($setting);[/tt]
and 1758
[tt]// $value = html_entity_decode($value);[/tt]
If you don’t, the html code gets translated back to an unknown character set. That’s suboptimal. If you convert everything into html entities, there’s no need to decode them when you print them on the page: the browser does that for you.
This had me stumped for a couple of hours, until I finally decided to do a search for "decode" in webloginpe.class.php... But now everything seems ok.
Sh|t! This ,"UTF-8" thingie solved ma fullname utf8 problem!
I did only make a search on $_POST[$field]), ENT_QUOTES and did paste the thingie right after it, before the first brackett...
But...
The same problem with username is still there... Which lines to mod?