MySQL command‑line client shows garbled Unicode characters in error messages and help output
0 reputation · 30 Sept 2021, 22:52 UTC
Goal: verify that Unicode characters typed at the mysql prompt are echoed correctly and that error messages and help text display without replacement symbols, assuming a MySQL 8.0 client connected to a server whose default character set is latin1.
Constraints: the client’s --default-character-set option only affects the connection character set after the handshake; the server may still send results in its own charset unless session variables are changed, and the pager command does not re‑encode output for external pagers. Additionally, terminal transliteration can interact with MySQL’s encoding, making it unclear which combination of client flags and session settings reliably restores proper UTF‑8 display across all interactive features.
Questions: Does specifying --default-character-set=utf8mb4 alone ensure correct echo of Unicode input and proper rendering of error messages? Is it also required to execute SET NAMES utf8mb4 (or set character_set_client/results) after connection to fix server‑side encoding? When using the pager command with an external program such as less, must the terminal’s LESSCHARSET or the client’s character_set_results be aligned to prevent loss of accented characters in piped output?