简体   繁体   English

第 1 行的“用户”列的数据太长

[英]Data too long for column 'users' at row 1

I'm working with Symfony2 and Mysql 8. while working on localhost wamp it workds perfectly but when working on a distant server using a server IIS the problem accure.我正在使用 Symfony2 和 Mysql 8。在 localhost wamp上工作时它工作得很好,但是在使用服务器IIS的远程服务器上工作时,问题就出现了。

While trying to insert in mysql database, i'm getting the following error在尝试插入 mysql 数据库时,我收到以下错误

  An exception occurred while executing 'INSERT INTO users (name,familyName) values (?,?) with 
  params["\xe9","name"]:
  SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1

The problem is that i'm inserting a special charachter é .问题是我要插入一个特殊的字符é i'm setting my table as UTF8_mb4.我将我的表设置为 UTF8_mb4。 and all characters get excepted expect é并且所有字符都得到例外期望é

Finally found a solution to the problem, it resides in the IIS, it reads my data as ASCII not UTF.终于找到了解决问题的方法,它位于 IIS 中,它将我的数据读取为 ASCII 而不是 UTF。 Fixed with the command:使用以下命令修复:

   reg add HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\w3svc\Parameters /v 
   FastCGIUtf8ServerVariables /t REG_MULTI_SZ /d REQUEST_URI\0PATH_INFO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM