Java Web Query, gender word Gencun is the number, 1 for male, 2 for female, take the data when the gender into Chinese characters displayed on the page, the SQL statement as follows, the result has been a problem
Select A.emp_id,a.emp_name, case when a.emp_gendar=1 then ' Male ' when a.emp_gendar=2 then ' female ' end as Emp_gendar, B.post_name
From T_employee_info A, T_position_info b
where a.post_id = b.post_id; Gender in the page does not appear, the display is a question mark, is expected to show male or female, online search data found is due to the improper setting of MySQL character encoding, mysql default character encoding is latin1, does not support Chinese, you must set the database encoding to support the Chinese encoding, in order to display correctly. Enter the database, enter: Show variables like ' character_set_% '; Discover Character_set_serverUTF8The value for Latin1 is found in the MySQL installation directory, locate the My.ini file, locate the [client] and [mysqld] fields in the My.ini file, add Default-character-set=utf8 below, save and close, Restart the MySQL service. Open and re-enter: Show variables like ' character_set_% '; Get the following results
You can then run the Web program, and the gender is shown as male and female as expected.
The Chinese content defined in the MySQL query statement is displayed as a question mark in the Java Web