开发者

php mysql flex unicode

开发者 https://www.devze.com 2023-02-03 14:17 出处:网络
I have a problem with saving the £ symbol to a mysql database. I am running a flex front end, with a php + mysql backend

I have a problem with saving the £ symbol to a mysql database.

  1. I am running a flex front end, with a php + mysql backend

  2. When I save a record from flex, the string gets sent to the server as "This amount is £10"

  3. 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

  4. 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"

  5. 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"

  6. 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:

  1. mysql_set_charset('utf8',$conn);
  2. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号