0
4

1 回答 1

0

Well, nginx encoding was UTF8 (confirmed on the headers), as were the MySQL tables.

Using an HTTP client like Postman still got me "null" as a replacement for special characters.

The problem persisted after changing Charset.forName("ISO-8859-1") to Charset.forName("UTF-8").

I solved it by setting the charset for MySQL at the connection level, on my.cnf:

[mysql]
character-set-client = utf8
default-character-set = utf8

[mysqld]
character-set-server = utf8
init-connect = 'SET NAMES utf8'

[client]
default-character-set = utf8
于 2014-04-09T14:45:52.043 回答