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

CreateParser.create behaves inconsistently depending on system default encoding #97

Open
dc-stripe opened this issue Nov 6, 2019 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@dc-stripe
Copy link

CreateParser.create takes a file path, but no option for an encoding, and so (I guess) uses the system default encoding. When the file has non-ASCII characters, as the current version does:
https://github.com/snowplow-referer-parser/referer-parser/blob/0a59810d7379ff731ccfcdeabea151e4e8b31c59/resources/referers.yml#L638
it can therefore behave inconsistently on different systems.

Library version:
1.0.0

Expected behavior:
I should be able to get the same referers.json file to work on different systems

Actual behavior:
If I use a UTF-8 encoded file on a system with a different default encoding, I get a MalformedInputException

Steps to reproduce:

Please try to be as detailed as possible so that we can reproduce and fix the issue
as quickly as possible.

  1. Convert the current referers.yml file to json and save it as UTF-8
  2. Pass this file path to CreateParser[IO].create on a system with a different default encoding
  3. Results in
java.nio.charset.MalformedInputException: Input length = 1
      at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
      at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
      at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
      at java.io.InputStreamReader.read(InputStreamReader.java:184)
      at java.io.BufferedReader.read1(BufferedReader.java:210)
      at java.io.BufferedReader.read(BufferedReader.java:286)
      at java.io.Reader.read(Reader.java:140)
      at scala.io.BufferedSource.mkString(BufferedSource.scala:96)
      at com.snowplowanalytics.refererparser.CreateParser$$anon$3.create(Parser.scala:52)
      at com.snowplowanalytics.refererparser.CreateParser$$anon$3.create(Parser.scala:50)
@chuwy chuwy added the bug Something isn't working label Nov 7, 2019
@chuwy
Copy link

chuwy commented Nov 7, 2019

Scheduling to 1.1.0, but will make sure to include it into 1.0.1 if such release will take a place.

@chuwy chuwy added this to the Version 1.1.0 milestone Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants