Posting emoji in an comment causes error 500 despite DB on utf8mb4_general_ci #10462

Closed
opened 2025-11-02 09:08:06 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @HerrIrrtum on GitHub (Mar 20, 2023).

Description

Gitea Version 1.9.0 (2023/03/20) on Debian Linux (X86_64) with the "single File" release.
(Updated from initial 1.19.0-rc0 over 1.19.0-rc1 to 1.19.0 final release).

Problem: Insert an emoji like "👁️" into the Users Full Name or a repository description or a comment causes an error 500.
That however shouldn't be the case.
After initially setting up the database wrong, I converted its character set to be

  • utf8mb4 COLLATE utf8mb4_unicode_ci

for the whole db plus also every single table.

So if I look i.e. into the "user" table and here for the "full_name" column it looks like this:

| full_name       | varchar(255)  | utf8mb4_general_ci|[...]
[...]
| description   | mediumtext    | utf8mb4_general_ci | [...]

This should be correct, does it?

I also did this on top of all that:

$ gitea --config /etc/gitea/app.ini convert
  2023/03/20 19:37:15 cmd/convert.go:32:runConvert() [I] AppPath: /usr/local/bin/gitea
  2023/03/20 19:37:15 cmd/convert.go:33:runConvert() [I] AppWorkPath: /var/lib/gitea
  2023/03/20 19:37:15 cmd/convert.go:34:runConvert() [I] Custom path: /var/lib/gitea/custom
  2023/03/20 19:37:15 cmd/convert.go:35:runConvert() [I] Log path: /var/lib/gitea/log
  2023/03/20 19:37:15 cmd/convert.go:36:runConvert() [I] Configuration file: /etc/gitea/app.ini
  Converted successfully, please confirm your database's character set is now utf8mb4

Still no dice.
I even restarted the whole server (not only services) afterwards, just to be on the save side. Nope. Error500.

Did I miss something?

Gitea Version

1.9.0

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

updateRepository: update: Error 1366 (22007): Incorrect string value: '\xF0\x9F\x91\x81\xEF\xB8...' for column giteamia.repository.description at row 1

Screenshots

No response

Git Version

git version 2.30.2

Operating System

Debian GNU/Linux 11

How are you running Gitea?

This single Binary
https://dl.gitea.com/gitea/1.19/gitea-1.19-linux-amd64

Database

MySQL

Originally created by @HerrIrrtum on GitHub (Mar 20, 2023). ### Description Gitea Version 1.9.0 (2023/03/20) on Debian Linux (X86_64) with the "single File" release. (Updated from initial 1.19.0-rc0 over 1.19.0-rc1 to 1.19.0 final release). Problem: Insert an emoji like "👁️" into the Users Full Name or a repository description or a comment causes an error 500. That however shouldn't be the case. After initially setting up the database wrong, I converted its character set to be - `utf8mb4 COLLATE utf8mb4_unicode_ci` for the whole db plus also every single table. So if I look i.e. into the "user" table and here for the "full_name" column it looks like this: ``` | full_name | varchar(255) | utf8mb4_general_ci|[...] [...] | description | mediumtext | utf8mb4_general_ci | [...] ``` This should be correct, does it? I also did this on top of all that: ``` $ gitea --config /etc/gitea/app.ini convert 2023/03/20 19:37:15 cmd/convert.go:32:runConvert() [I] AppPath: /usr/local/bin/gitea 2023/03/20 19:37:15 cmd/convert.go:33:runConvert() [I] AppWorkPath: /var/lib/gitea 2023/03/20 19:37:15 cmd/convert.go:34:runConvert() [I] Custom path: /var/lib/gitea/custom 2023/03/20 19:37:15 cmd/convert.go:35:runConvert() [I] Log path: /var/lib/gitea/log 2023/03/20 19:37:15 cmd/convert.go:36:runConvert() [I] Configuration file: /etc/gitea/app.ini Converted successfully, please confirm your database's character set is now utf8mb4 ``` Still no dice. I even restarted the whole server (not only services) afterwards, just to be on the save side. Nope. Error500. Did I miss something? ### Gitea Version 1.9.0 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist updateRepository: update: Error 1366 (22007): Incorrect string value: '\xF0\x9F\x91\x81\xEF\xB8...' for column `giteamia`.`repository`.`description` at row 1 ### Screenshots _No response_ ### Git Version git version 2.30.2 ### Operating System Debian GNU/Linux 11 ### How are you running Gitea? This single Binary https://dl.gitea.com/gitea/1.19/gitea-1.19-linux-amd64 ### Database MySQL
GiteaMirror added the type/bug label 2025-11-02 09:08:06 -06:00
Author
Owner

@HerrIrrtum commented on GitHub (Mar 20, 2023):

I think we can close this. I could reproduce this directly in mariadb. The trick seems to be to force mariadb to use the "SET NAMES utf8mb4;" feature.

@HerrIrrtum commented on GitHub (Mar 20, 2023): I think we can close this. I could reproduce this directly in mariadb. The trick seems to be to force mariadb to use the "SET NAMES utf8mb4;" feature.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10462