Hi, i use this code to add a new record to my db. But the snippet handles our swedish characters wrong even tho thay are sent correctly. I run the snippet in an iframe to avoid new pageload.
How chan i define a charset for my db-connection?
/* ADD NEW PRODUCT */
case 2:
/* Add Package */
$path = MODX_CORE_PATH . 'components/products/';
$result = $modx->addPackage('products',$path . 'model/','custom_');
if (! $result) {return 'failed to add package';};
/* Open record with id */
$rsProd = $modx->newObject('Products');
/* Set fields */
$rsProd->set('txName', $prodStat);
$rsProd->set('iStatus', 1);
/* Save */
if(! $rsProd->save()){return "failed to save data";}else{$output = $prodStat;}
/*$output = "<script>self.parent.location.reload(true);</script>";*/
break;
____________________________________________________
-
MODX Staff
- 10,725 Posts
You'll need to provide details of your MySQL connection and charset details.
This might be relevant:
http://bobsguides.com/convert-db-utf8.html
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html