Encoding 分解损坏的UTF-8变更集

Encoding 分解损坏的UTF-8变更集,encoding,utf-8,liquibase,Encoding,Utf 8,Liquibase,我使用的是Liquibase 2.0.5(但已经用最新的3.2.0进行了测试,但没有结果),当我尝试用包含UTF-8字符的SQL变更集更新MySQL 5.5数据库时,所有这些似乎都转换为ASCII,因为我得到的不是波兰语字母,而是“?” 下面是我正在使用的命令: java -jar liquibase.jar --changeLogFile=changesets.xml --url="jdbc:mysql://localhost/dbname" --username=user --passwor

我使用的是Liquibase 2.0.5(但已经用最新的3.2.0进行了测试,但没有结果),当我尝试用包含UTF-8字符的SQL变更集更新MySQL 5.5数据库时,所有这些似乎都转换为ASCII,因为我得到的不是波兰语字母,而是“?”

下面是我正在使用的命令:

java -jar liquibase.jar --changeLogFile=changesets.xml --url="jdbc:mysql://localhost/dbname" --username=user --password=pass --driver=com.mysql.jdbc.Driver --classpath=mysql-connector-java-5.1.21-bin.jar update
changeset.xml类似于:

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

  <include file="Changesets/2014.26/changesets.xml"/>
</databaseChangeLog>
追加--logLevel=debug显示已损坏的字符

DEBUG 6/25/14 11:17 AM:liquibase: SQLFile file:Changesets/2014.26/20140623_1700_tmarcinkowski_ss_303.sql
DEBUG 6/25/14 11:17 AM:liquibase: SQLFile file contents is:

INSERT INTO `catalog` (`category_id`, `parent_category_id`, `name`, `priority`, `photo`, `icon_catalog`, `icon_breadcrumbs`, `lft`, `rgt`) VALUES
(0, NULL, 'root', 0, '', '', '', 1, 1262),
(1, 0, 'Art. spo?ywcze', 1, '', '', '', 2, 755),
(2, 1, 'Owoce i Warzywa', 4, '', '', '', 3, 60),
(3, 1, 'Nabia?', 2, '', '', '', 61, 146),
(4, 1, 'Mi?so, W?dliny', 5, '', '', '', 147, 206),
(5, 1, 'Ryby i Owoce morza', 9, '', '', '', 207, 234),
(6, 1, 'Mro?onki i lody', 10, '', '', '', 235, 266),
(7, 1, 'Pieczywo', 1, '', '', '', 267, 324);
在连接字符串中添加“useJvmCharsetConverters=true”和“charSet=UTF-8”也没有帮助,就像在变更集的开头添加“SET NAMES utf8;”。 所有文件都是UTF-8


有人知道如何处理吗?

这是Connector/J的问题:因为v5.1.3 Connector/J自动检测配置了字符集的服务器,或者将使用字符编码=xxx传递的Java编码utf-8视为utf8mb4

只需向MySQL连接URL添加useUnicode和characterEncoding参数

在命令行中:

-url="jdbc:mysql://localhost/dbname?useUnicode=true&characterEncoding=UTF-8"
或在liquibase.properties文件中:

url: jdbc:mysql://localhost/dbname?useUnicode=true&characterEncoding=UTF-8

看起来像个虫子。你能在liquibase.jira.com上打开一个问题,并附上你的实际.sql文件(以确保文件BOM设置和所有内容都正确)。嗨,伙计们,这个问题有什么进展吗?我清楚地记得我已经在github上发布了这个问题,但现在找不到了。新版本的liquidbase是否支持非拉丁字符?问题追踪器在哪里?
-url="jdbc:mysql://localhost/dbname?useUnicode=true&characterEncoding=UTF-8"
url: jdbc:mysql://localhost/dbname?useUnicode=true&characterEncoding=UTF-8