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

ArgumentError: invalid byte sequence in US-ASCII on v2.2.0 in Docker #277

Open
jamesottaway opened this Issue Jun 3, 2016 · 6 comments

Comments

Projects
None yet
7 participants
@jamesottaway

jamesottaway commented Jun 3, 2016

It looks like lib/ffaker/name_ua.rb is encoded as ASCII, not UTF-8.

❯ docker run --rm -it ruby:2.3.1 bash
root@dc8455d6bc16:/# gem install ffaker -v '2.2.0'
Fetching: ffaker-2.2.0.gem (100%)
Successfully installed ffaker-2.2.0
1 gem installed
root@dc8455d6bc16:/# irb -r ffaker
/usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/utils/module_utils.rb:15:in `split': invalid byte sequence in US-ASCII (ArgumentError)
        from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/utils/module_utils.rb:15:in `const_missing'
        from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb:10:in `<module:NameUA>'
        from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb:6:in `<module:FFaker>'
        from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb:5:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:33:in `block in <module:FFaker>'
        from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:32:in `each'
        from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:32:in `<module:FFaker>'
        from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `require'
        from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
        from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
        from /usr/local/lib/ruby/2.3.0/irb/init.rb:281:in `block in load_modules'
        from /usr/local/lib/ruby/2.3.0/irb/init.rb:279:in `each'
        from /usr/local/lib/ruby/2.3.0/irb/init.rb:279:in `load_modules'
        from /usr/local/lib/ruby/2.3.0/irb/init.rb:21:in `setup'
        from /usr/local/lib/ruby/2.3.0/irb.rb:378:in `start'
        from /usr/local/bin/irb:11:in `<main>'
root@dc8455d6bc16:/# file /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb
/usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb: Ruby module source, ASCII text
@oliworx

This comment has been minimized.

Show comment
Hide comment
@oliworx

oliworx Jun 25, 2016

I get the same error on GiltLab CI:

/usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/utils/module_utils.rb:15:in `split': invalid byte sequence in US-ASCII (ArgumentError)
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/utils/module_utils.rb:15:in `const_missing'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb:10:in `<module:NameUA>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb:6:in `<module:FFaker>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb:5:in `<top (required)>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:33:in `require'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:33:in `block in <module:FFaker>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:32:in `each'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:32:in `<module:FFaker>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:1:in `<top (required)>'

oliworx commented Jun 25, 2016

I get the same error on GiltLab CI:

/usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/utils/module_utils.rb:15:in `split': invalid byte sequence in US-ASCII (ArgumentError)
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/utils/module_utils.rb:15:in `const_missing'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb:10:in `<module:NameUA>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb:6:in `<module:FFaker>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker/name_ua.rb:5:in `<top (required)>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:33:in `require'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:33:in `block in <module:FFaker>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:32:in `each'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:32:in `<module:FFaker>'
    from /usr/local/bundle/gems/ffaker-2.2.0/lib/ffaker.rb:1:in `<top (required)>'
@Kukunin

This comment has been minimized.

Show comment
Hide comment
@Kukunin

Kukunin Jul 30, 2016

The same for me, rolling back to 2.1.0 resolved problem

Kukunin commented Jul 30, 2016

The same for me, rolling back to 2.1.0 resolved problem

@pawelma

This comment has been minimized.

Show comment
Hide comment
@pawelma

pawelma Oct 13, 2016

Contributor

Did you tried to use export LC_ALL=en_US.UTF-8 command before running your code?

Contributor

pawelma commented Oct 13, 2016

Did you tried to use export LC_ALL=en_US.UTF-8 command before running your code?

@mikesive

This comment has been minimized.

Show comment
Hide comment
@mikesive

mikesive Nov 15, 2016

Getting the same issue, I tried LC_ALL=en_US.UTF-8, which didn't work. I downgraded as @Kukunin suggested and the problem went away.

mikesive commented Nov 15, 2016

Getting the same issue, I tried LC_ALL=en_US.UTF-8, which didn't work. I downgraded as @Kukunin suggested and the problem went away.

@zedtux

This comment has been minimized.

Show comment
Hide comment
@zedtux

zedtux Nov 29, 2016

Setting the following fixed the issue to me:

export LC_ALL=C.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

zedtux commented Nov 29, 2016

Setting the following fixed the issue to me:

export LC_ALL=C.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

nickgnd added a commit to nickgnd/collaborators that referenced this issue Nov 29, 2016

Dockerize hanami app
- add dockerfile and docker-compose with additional postgres container
- Downgrade ffaker gem to v2.1.0 to avoid encoding issues with Docker
  (see ffaker/ffaker#277)

nickgnd added a commit to nickgnd/collaborators that referenced this issue Nov 30, 2016

Dockerize hanami app
- add dockerfile and docker-compose with additional postgres container
- Downgrade ffaker gem to v2.1.0 to avoid encoding issues with Docker
  (see ffaker/ffaker#277)
@marocchino

This comment has been minimized.

Show comment
Hide comment
@marocchino

marocchino Jan 1, 2017

Member

I checked file encoding of our project but, did not found strange things.
As ffaker use utf-8, It looks obvious to have to set lang.
but, seems docker team does not want to change default value.

For now, you need to set encoding explicitly like this:

$ docker run --rm -it -e LANG=C.UTF-8 ruby:2.4.0 bash
root@fee70e00af3c:/# gem install ffaker
Fetching: ffaker-2.4.0.gem (100%)
Successfully installed ffaker-2.4.0
1 gem installed
root@fee70e00af3c:/# irb -r ffaker
Member

marocchino commented Jan 1, 2017

I checked file encoding of our project but, did not found strange things.
As ffaker use utf-8, It looks obvious to have to set lang.
but, seems docker team does not want to change default value.

For now, you need to set encoding explicitly like this:

$ docker run --rm -it -e LANG=C.UTF-8 ruby:2.4.0 bash
root@fee70e00af3c:/# gem install ffaker
Fetching: ffaker-2.4.0.gem (100%)
Successfully installed ffaker-2.4.0
1 gem installed
root@fee70e00af3c:/# irb -r ffaker

CWDSIntake pushed a commit to ca-cwds/acceptance_testing that referenced this issue Aug 8, 2017

Fix ASCII error when running tests
See ffaker/ffaker#277 for why this new env var
is required

[#hotfix]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment