php mysql flex unicode
I have a problem with saving the £ symbol to a mysql database.
I am running a flex front end, with a php + mysql backend
When I save a record from flex, the string gets sent to the server as "This amount is £10"
php views the string as above, and when it gets saved into the DB, it gets saved as "This amount is £10". My understanding is that th开发者_运维技巧is is correct based on MySQL or PHP is appending a  whenever the £ is used
I now retrieve the above record, and it gets sent to flex as "This amount is £10". Flex correctly displays this in a textarea as "This amount is £10"
I change another field in the same record in flex, and re-save the transaction. The string now gets sent to the server as "This amount is £10"
The record is now saved into the DB as "The amount is £10". Each time the record is re-saved, this effect snowballs.
Thanks for any advice you can give.
use the unicode £ in replacement of the £ sign before you insert to MySQL.
check your database charset? That could be the issue.
Sounds to me as a charset issue. I haven't used flex, I use Dojo forms with Zend Framework and Doctrine 2 that handles everything in utf-8 format.
Try setting everything to utf-8:
- mysql_set_charset('utf8',$conn);
- add in your header: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I've had similar issues when the form is ISO-8859-1, you can also try the php funciton: utf8_encode() when getting the values from the form. Sometimes I've found it hard to find the ISO-8859-1 source and then I usually try to debug using the decode/encode functions.
At the end of the day, this seemed to be an amfphp issue, as discovered at ghalex.com/blog/as3flexdb-and-utf8
精彩评论