# Error 1366 (22007): Incorrect string value:

**URL:** <https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297>\
**Category:** 中文求助(Chinese Only)\
**Created:** [May 18, 2023, 8:03am UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297 "2023-05-18T08:03:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jim](https://forum.gitea.com/u/jim)\
**Post date:** [May 18, 2023, 8:03am UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297/1 "2023-05-18T08:03:40Z")

</div>

failed: update: Error 1366 (22007): Incorrect string value: ‘\xF0\x9F\x9A\x80\xE5\x82…’ for column `Dev_gitea_old`.`repository`.`description` at row 1

镜像的时候报这种错误怎么解决？  
数据库以及表的编码都是utf8mb4 的

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [May 18, 2023, 3:33pm UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297/2 "2023-05-18T15:33:17Z")

</div>

What is result of following query? I think encoding of column might not be utf8mb4 if database and table encoding are set correctly.

```sql
USE Dev_gitea_old;
SHOW FULL COLUMNS FROM repository;

```

If above shows `description` as proper collation, it could be issue with connection encoding. This query shows what connection settings are:

```sql
SELECT * FROM performance_schema.session_variables
WHERE VARIABLE_NAME IN (
  'character_set_client', 'character_set_connection',
  'character_set_results', 'collation_connection'
) ORDER BY VARIABLE_NAME;

```

[https://dev.mysql.com/doc/refman/8.0/en/charset-connection.html](https://dev.mysql.com/doc/refman/8.0/en/charset-connection.html)

---

<div class="post-metadata">

**Author:** ![jim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jim](https://forum.gitea.com/u/jim)\
**Post date:** [May 19, 2023, 5:26am UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297/3 "2023-05-19T05:26:06Z")

</div>

> 块引用  
> What is result of following query? I think encoding of column might not be utf8mb4 if database and table encoding are set correctly.

列也是utf8mb4的

> 块引用  
> If above shows `description` as proper collation, it could be issue with connection encoding. This query shows what connection settings are:

客户端连接的也是utf8mb4的

---

<div class="post-metadata">

**Author:** ![jim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jim](https://forum.gitea.com/u/jim)\
**Post date:** [May 19, 2023, 5:28am UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297/4 "2023-05-19T05:28:04Z")

</div>

可以镜像下这个地址 [GitHub - aoaostar/toolbox: 🚀傲星工具箱，一个在线工具箱](https://github.com/aoaostar/toolbox.git)  
此地址从网上找的有侵权请联系删除

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [May 20, 2023, 7:57pm UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297/5 "2023-05-20T19:57:03Z")

</div>

Can you share database software name and version? Can you also share configuration file for database software (in MySQL it would be `my.cnf`)?

---

<div class="post-metadata">

**Author:** ![jim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jim](https://forum.gitea.com/u/jim)\
**Post date:** [May 29, 2023, 2:13am UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297/6 "2023-05-29T02:13:59Z")

</div>

10.11.3-MariaDB, for Linux (x86\_64)

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [May 30, 2023, 3:04am UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297/7 "2023-05-30T03:04:09Z")

</div>

Can you check `character_set_connection`, `collation_connection` in my.cnf? These options default to `utf8mb3` and might be causing problem.

If not issue, you can check other similar name variables. Here is [documentation](https://mariadb.com/kb/en/server-system-variables/#character_set_connection).

---

<div class="post-metadata">

**Author:** ![jim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jim](https://forum.gitea.com/u/jim)\
**Post date:** [June 2, 2023, 8:00am UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297/8 "2023-06-02T08:00:19Z")

</div>

![微信截图_20230602155824](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/d/d150599562e314473b62f041edb69e81658e61e0.png)

 ![微信截图_20230602155901](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/a/a875edcf723c045b9a95491d1b4592f88fd72737.png)

这是my.cnf

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [June 22, 2023, 2:05pm UTC](https://forum.gitea.com/t/error-1366-22007-incorrect-string-value/7297/9 "2023-06-22T14:05:42Z")

</div>

Apologies for late reply. I recently saw issue on GitHub that reminded me of this post.

Can you verify that `CHARSET` under `[database]` is set to `utf8mb4`? See [Config Cheat Sheet](https://docs.gitea.com/administration/config-cheat-sheet), there is a recent bug where it is accidentally set to utf8 which prevents users adding emojis to text which is what is causing `Incorrect string value` error.
