This is because when the query is sent to MySQL, it’s encoded using the default charset, which is usually set to latin.
For some reason, it’s not a problem in Windows.
For PHP, when creating a connection to MySQL, call set_charset to set the character set to UTF8.
For ASP.NET Core application, set the charset in the connection string: CharSet=utf8.