Defect #34810

SQL Error with UTF8 character greater or equals

Added by Florent H. 9 months ago. Updated 7 months ago.

Status:ReopenedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Wiki
Target version:-
Resolution:Invalid Affected version:4.1.1

Description

I am currently getting a fatal error using this character (greater or equals) editing a wiki page

https://fr.wiktionary.org/wiki/%E2%89%A5

Error

app/models/wiki_page.rb:249:in `block in save_with_content'
app/models/wiki_page.rb:245:in `save_with_content'
app/controllers/wiki_controller.rb:180:in `update'
lib/redmine/sudo_mode.rb:65:in `sudo_mode'
Started PUT "/projects/site-web/wiki/Breakpoints" for 92.167.55.166 at 2021-02-26 17:46:08 +0000
Processing by WikiController#update as HTML
  Parameters: {"utf8"=>"<E2><9C><93>", "authenticity_token"=>"XXX", "content"=>{"version"=>"1", "text"=>"h1. Breakpoints\r\n\r\nNous utilisons bootstrap 5 avec ses breakpoints officiels\r\n\r\nhttps://getbootstrap.com/docs/5.0/layout/breakpoints/\r\n\r\n|_.Breakpoint|_.Class infix|_.Dimensions|_.Appareil|\r\n|X-Small|None|<576px|Mobile|\r\n|Small|sm|<E2><89><A5>576px|Mobile|\r\n|Medium|md|<E2><89><A5>768px|Mobile|\r\n|Large|lg|<E2><89><A5>992px|Ordinateur|\r\n|Extra large|xl|<E2><89><A5>1200px|Ordinateur|\r\n|Extra extra large|xxl|<E2><89><A5>1400px|Ordinateur|\r\n", "comments"=>""}, "wiki_page"=>{"parent_id"=>"25"}, "commit"=>"Sauvegarder", "project_id"=>"site-web", "id"=>"Breakpoints"}
  Current user: Me (id=1)
Completed 500 Internal Server Error in 257ms (ActiveRecord: 249.6ms)

ActiveRecord::StatementInvalid (Mysql2::Error: Incorrect string value: '\xE2\x89\xA5576...' for column `redmine`.`wiki_contents`.`text` at row 1: INSERT INTO `wiki_contents` (`page_id`, `author_id`, `text`, `updated_on`, `version`) VALUES (27, 1, 'h1. Breakpoints\r\n\r\nNous utilisons bootstrap 5 avec ses breakpoints officiels\r\n\r\nhttps://getbootstrap.com/docs/5.0/layout/breakpoints/\r\n\r\n|_.Breakpoint|_.Class infix|_.Dimensions|_.Appareil|\r\n|X-Small|None|<576px|Mobile|\r\n|Small|sm|<E2><89><A5>576px|Mobile|\r\n|Medium|md|<E2><89><A5>768px|Mobile|\r\n|Large|lg|<E2><89><A5>992px|Ordinateur|\r\n|Extra large|xl|<E2><89><A5>1200px|Ordinateur|\r\n|Extra extra large|xxl|<E2><89><A5>1400px|Ordinateur|\r\n', '2021-02-26 17:46:08', 1)):

Here is my redmine's environment

Environment:
  Redmine version                4.1.1.stable
  Ruby version                   2.6.3-p62 (2019-04-16) [x86_64-linux]
  Rails version                  5.2.4.2
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            2.25.1
  Filesystem                     
Redmine plugins:
  no plugin installed

History

#1 Updated by Florent H. 9 months ago

To make it work quickly, I just replaced the character by >=, this is not a problem for my usage.

#2 Updated by Marius BALTEANU 9 months ago

  • Status changed from New to Needs feedback

What kind of database encoding are you using?

You can use the following queries to retrieve this:

1. MySQL config:

SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';

2. Redmine database:

SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "<redmine_database_name>";

#3 Updated by Marius BALTEANU 7 months ago

  • Status changed from Needs feedback to Closed
  • Resolution set to Invalid

Please reopen with the required information.

#4 Updated by Florent H. 7 months ago

  • Status changed from Closed to Reopened

Sorry, I missed the notification email.

MariaDB [(none)]> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+--------------------+
| Variable_name            | Value              |
+--------------------------+--------------------+
| character_set_client     | utf8mb4            |
| character_set_connection | utf8mb4            |
| character_set_database   | utf8mb4            |
| character_set_filesystem | binary             |
| character_set_results    | utf8mb4            |
| character_set_server     | utf8mb4            |
| character_set_system     | utf8               |
| collation_connection     | utf8mb4_general_ci |
| collation_database       | utf8mb4_general_ci |
| collation_server         | utf8mb4_general_ci |
+--------------------------+--------------------+
10 rows in set (0.128 sec)
MariaDB [(none)]> SELECT default_character_set_name FROM information_schema.SCHEMATA WHERE schema_name = "redmine";
+----------------------------+
| default_character_set_name |
+----------------------------+
| utf8mb4                    |
+----------------------------+
1 row in set (0.000 sec)

Also available in: Atom PDF