Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failure for wip branch: should_parse_example(com.moandjiezana.toml.RealWorldTest): expected:<[??]> but was:<[中国]> #22

Closed
bruno-medeiros opened this issue Aug 13, 2015 · 5 comments

Comments

@bruno-medeiros
Copy link

I checkout the wip branch (as well a v.0.4.0 release) and when I try to do mvn clean install I get this test failure:

Results :

Failed tests:   should_parse_example(com.moandjiezana.toml.RealWorldTest): expected:<[??]> but was:<[中国]>

Full Maven output: https://gist.github.com/bruno-medeiros/26e27b6e546d9f27276f

The Travis-CI build seems ok, so maybe it's a OS-related bug? I'm on Windows 7.

@mwanji mwanji added bug and removed bug labels Aug 14, 2015
@mwanji
Copy link
Owner

mwanji commented Aug 14, 2015

It seems to be reading the example.toml file correctly, but not the literal string in the test expectation. Could you make sure the source file is being read as UTF-8?

@bruno-medeiros
Copy link
Author

Yup, it's being read as ASCII or something other than UTF-8.

The problem is in com.moandjiezana.toml.RealWorldTest.should_parse_example() in the line new Toml().parse(new File(getClass().getResource("example.toml").getFile())); which uses a FileReader. This a is problem because FileReader assumes the default charset which on Windows is not UTF8. (BTW FileReader doesn't do auto-detecting of input encoding, so putting a UTF8 signature in the file has no effect either)

bruno-medeiros added a commit to bruno-medeiros/toml4j that referenced this issue Aug 14, 2015
mwanji added a commit that referenced this issue Aug 15, 2015
@mwanji
Copy link
Owner

mwanji commented Aug 15, 2015

Thanks for the PR. I didn't use it directly, but integrated your fix directly into the Toml#read(File) method. Please let me know if it works for you on Windows now.

@bruno-medeiros
Copy link
Author

Yup that works as well 👍

@mwanji
Copy link
Owner

mwanji commented Aug 18, 2015

Great, thanks for checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants