Just wanted to follow up on this and leave a message in case anybody else in the future has this issue.
To recap: I built a database utilizing Xataface as the front end for the sole purpose of collecting, sorting, and revising text and image data on vendors my company uses (this data would put uploaded to another system later). We have about 7 people working on this all the time, and some people were writing descriptions in Word and then copying and pasting into Xataface. An issue arose when hyphens or single/double quote or ellipses were used because they come over from Word as different characters. The data was being stored in the database properly, but when someone would edit the same record later, the data would not show up in the textarea widget, and if the record was saved, the data was deleted. I played around with encodings and anything else I could think of to try to get the data to show up when these symbols were present, but to no avail. I finally decided to simply do a find/replace for each of the characters every time the record was saved. It took FOREVER to find a proper and easily implemented solution, but eventually I did. Below is the code I use to rid the data of the crappy Word characters:
- Code: Select all
function afterSave(&$record){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
$recordid = $record->getValue('Id');
$sql = "UPDATE vend_01 SET Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(145), '\''), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(146), '\''), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(147), '\"'), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(148), '\"'), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(150), '-'), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(151), '--'), Location_Short_Description__c = REPLACE(Location_Short_Description__c, CHAR(133), '...') WHERE Id='$recordid'";
$res = mysql_query($sql);
...
}
I created queries for each field that needed it (for me that was 7) and simply changed out the field name in the query and iterated my variables (so $sql2 and $res2, etc.), and it now works just perfect. Sorry for the long post on an old topic, but Xataface has been an absolute life-saver when it comes to our project and this aspect of it took me the longest; hopefully someone finds this useful in the future!