【问题标题】:Can I store Unicode from PHP to MySQL? [closed]我可以将 Unicode 从 PHP 存储到 MySQL 吗? [关闭]
【发布时间】:2013-09-06 15:33:02
【问题描述】:

我正在尝试保存一个字符串:

`Error Number: 1366</p><p>Incorrect string value: '\xCC\xC7 Ree...' for column 'ShipToName' at row 1</p><p>INSERT INTO `default_orders` (`OrderNumber`, `ShipCarrier`, `ShipService`, `ShipDate`, `ShipToName`, `ShipToAddress1`, `ShipToAddress2`, `ShipToCity`, `ShipToState`, `ShipToZip`, `ShipToCountry`, `ShipToPhone`, `SKU1`, `ProdName1`, `Qty1`, `batch_id`, `timestamp`, `client_id`, `status`) VALUES ('LIFEG-1004648', 'USPS', 'First Class Mail', '', 'Zo�� Reed', '17`

但它不会保存。如果这很重要,我正在使用 CodeIgniter Active 记录。

【问题讨论】:

  • 您的输入编码和目标 COLLATION 是什么?
  • MySQL COllation 是:utf8_unicode_ci。该字段的类型为TEXT
  • 你的输入编码是什么?

标签: php mysql activerecord


【解决方案1】:

在您的 HTML 中使用 form_open('controller/function') 函数,它将 accept-charset="utf-8" 添加到表单中,将排序规则更改为 utf8_bin 并尝试一次。

【讨论】:

    猜你喜欢
    • 2014-10-24
    • 1970-01-01
    • 1970-01-01
    • 2013-08-31
    • 1970-01-01
    • 1970-01-01
    • 2012-12-20
    • 2015-02-19
    • 2012-01-10
    相关资源
    最近更新 更多