Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Chinese word become unrecognizable code using "addSchema(SCHEMA,scriptSources)" method #115

Closed
flian opened this issue Oct 18, 2017 · 9 comments · Fixed by #119
Closed
Assignees

Comments

@flian
Copy link

flian commented Oct 18, 2017

Using bellow cofig to start embedded-mysql:

MysqldConfig config = aMysqldConfig(v5_6_35)
                .withCharset(UTF8)
                .withPort(getPort())
                .withUser(USERNAME, PASSWORD)
                .withTimeout(2, TimeUnit.MINUTES)
                .withServerVariable("max_connect_errors", 666)
                .build();

EmbeddedMysql mysqld = anEmbeddedMysql(config, downloadConfig)
                .addSchema(SCHEMA,"db/001_init.sql")
                .start();

where db/001_init.sql:

create table t1 (col1 INTEGER NOT NULL,col2 VARCHAR(10));

INSERT INTO t1 values(10, "你好!");

after mysql start, "你好!" become unrecognizable code in table.

after research, probability fix:

add paramter to MysqlClient.java about line 54, after "--password=" with

"--default-character-set=utf8".

@viliusl
Copy link
Collaborator

viliusl commented Jan 16, 2018

@flian sorry for delay (PRs make it faster:)) - I added tests to see if I can reproduce issue you raised, but it passed nicely on my machine (os x) - let's see if other OS'es are fine as well. Tried several major mysql versions as well (5.6, 5.7).

btw - what OS are you using?

@flian
Copy link
Author

flian commented Jan 19, 2018

@viliusl I'm using Windows7/Windows10.

just test on my Windows10 laptop, seems issue still there.

@viliusl
Copy link
Collaborator

viliusl commented Jan 23, 2018

@flian well. I work on OSX, so cannot reproduce locally, but my PR with hypothetical fix is failing on windows CI - #119. I will get to it eventually, but really hard to debug - maybe you want to pull it and take a stab at possible fix?

@viliusl viliusl self-assigned this Jan 23, 2018
@flian
Copy link
Author

flian commented Jan 25, 2018

@viliusl just run integrate test on branch "chinese-fix"

  1. for mysql-v5_6_latest, your fix should work.
  2. for mysql-v5_7_latest, your fix should work after merge with fix Unable to start EmbeddedMysql on Window 7 using v5_7_latest #121

@viliusl
Copy link
Collaborator

viliusl commented Jan 25, 2018

@flian thanks alot for checking this out. Sadly https://ci.appveyor.com/project/viliusl/wix-embedded-mysql/build/496/job/ye36juajk7x1fd6c#L880 is failing:/ Guess will need to figure out out before merging.

@flian
Copy link
Author

flian commented Jan 25, 2018

seems "ExtendedCharsetTest" failing:

case 1 - "EmbeddedMysql instance", it work fine on my laptop. review ci logs, I guess some platform can't support non-latin charset as mySQL username&password
case 2 - passed both my latop and ci.
case 3 - work on my laptop but failing on ci, review log, seems similar problem with case 1, I guess charset was not right while "aMigrationWith" write temp file.

In my case, we use embeddedMysql import seeds data from sql file and run integration test.
So, I'm very appreciate @viliusl , as support case 2 is grate enough :)

anyway, I will try to find out why case 1 and case 3 is not working on CI.

@viliusl
Copy link
Collaborator

viliusl commented Jan 27, 2018

@flian - I added those cases just to figure out what works and what not. I could drop case 1 for now, but just for symmetry I would want case 2 and case 3 to work. Will dig into it myself.

@viliusl viliusl reopened this Jan 28, 2018
@viliusl
Copy link
Collaborator

viliusl commented Jan 28, 2018

@flian - I released version 3.0.2 with fixes for migrations with non-latin characters. Would be awesome if you could verify it does the trick for you and close issue if it does. Thanks!

@flian
Copy link
Author

flian commented Jan 30, 2018

@viliusl Thanks very much. Just upgrade to 3.0.2, work great.

@flian flian closed this as completed Jan 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants