Skip to content

ArgumentError: invalid byte sequence in US-ASCII#35

Closed
ram-ai-kumar wants to merge 1 commit intorails:masterfrom
ram-ai-kumar:master
Closed

ArgumentError: invalid byte sequence in US-ASCII#35
ram-ai-kumar wants to merge 1 commit intorails:masterfrom
ram-ai-kumar:master

Conversation

@ram-ai-kumar
Copy link

Accented characters in the name are causing this error.

@JangoSteve
Copy link
Member

Instead of changing André's (@indirect's) name, could you instead add this to the top of the gemspec and see if it fixes it (if that doesn't work, see if adding it to your Gemfile fixes it):

LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

I know I wouldn't want my name misspelled in the gemspec if avoidable ;-)

@ram-ai-kumar
Copy link
Author

Greetings Steve,

On 22-Nov-2011, at 3:07 AM, Steve Schwartz wrote:

I haven't ever had this problem, so I'm not sure how to replicate it. Instead of changing Andr's (@indirect's) name, could you instead add this to the top of the gemspec and see if it fixes it (if that doesn't work, see if adding it to your Gemfile fixes it):

LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

I wouldn't want my name misspelled in the gemspec if avoidable ;-)

I totally agree. I googled for this error and found the same solution.
This solution works for me in exporting these variables into environment.


Reply to this email directly or view it on GitHub:
#35 (comment)

Regards, Ram


Dream it. Discuss it. Watch it.

+91-95-606-DELHI (+91-95606-33544)
ramonrails @ YIM, MSN, GTalk, Skype, twitter, facebook, linkedin
http://www.sarvasv.in
http://in.linkedin.com/in/ramonrails
http://www.flickr.com/photos/ramonrails
http://bit.ly/ramonrails_profile

This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person.

@JangoSteve
Copy link
Member

Did you have to export these to your environment, or would it work to add them just to the gemspec? It'd be nice if installing this gem didn't rely on having a specific lang setting already in the environment.

@indirect
Copy link
Member

If you're running ruby web servers with LANG set to ASCII, won't that just mask the problem until you run into it later with UTF-8 input from the web?

On Nov 21, 2011, at 12:25 PM, Steve Schwartz wrote:

Did you have to export these to your environment, or would it work to add them just to the gemspec? It'd be nice if installing this gem didn't rely on having a specific lang setting already in the environment.


Reply to this email directly or view it on GitHub:
#35 (comment)

@JangoSteve
Copy link
Member

@indirect, typically I would agree, but nothing says that the site running on your web server takes any input from the web. If there were no legitimate reasons to have LANG set to ASCII, I would assume it wouldn't be an option (even though I can't really think of any).

@indirect
Copy link
Member

Many (older?) Linuxes just default to ASCII, because they assume that you will not deal with any files or text that is in any other encoding. So no, I don't really think there is a legitimate reason for your web server to have LANG set to ASCII anymore. :)

On Nov 21, 2011, at 12:33 PM, Steve Schwartz wrote:

@indirect, typically I would agree, but nothing says that the site running on your web server takes any input from the web. If there were no legitimate reasons to have LANG set to ASCII, I would assume it wouldn't be an option (even though I can't really think of any).


Reply to this email directly or view it on GitHub:
#35 (comment)

@JangoSteve
Copy link
Member

Eh, fair enough. At least we have this ticket now with a documented solution if anyone else comes across it in the googles.

@ramonrails, I think we're going to close this one down, but thanks for reporting it :-)

@JangoSteve JangoSteve closed this Nov 21, 2011
@nofxx
Copy link

nofxx commented Nov 25, 2011

Crashes deploy in capistrano Ruby 1.9.3p0. Looks like archlinux doesn't set the LC_ALL var.

$ echo $LANG    ->  en_US.UTF-8
$ echo $LC_ALL  ->

Fix:

  task :bundle_new_release do
    run "cd #{release_path} && LC_ALL='en_US.UTF-8' #{ruby_bins}/bundle install --path vendor/bundle --without test"
  end

@JangoSteve
Copy link
Member

@nofxx, you should be able to fix the problem by updating the server you're deploying to.

$ export LANG=en_US.UTF-8
$ export LC_ALL=en_US.UTF-8

Then you don't have to set the variables every time in your cap task.

@nofxx
Copy link

nofxx commented Nov 26, 2011

@JangoSteve, that'll work if you add it to somwhere on /etc/profiles (for all users) I imagine, otherwise the vars are persisted in per session basis.

@codepianist
Copy link

Thank u guys, this solution helps me a lot...

@pjlegato
Copy link

Is there any way to make the gem itself alter its environment to have these variables set as it gets installed? A gem installation ideally shouldn't require the end user to make environmental alterations before installing it.

@JangoSteve
Copy link
Member

@pjlegato agreed, see my first comment. If anyone having the problem wants to submit a patch, I'd be happy to take a look.

@ndbroadbent
Copy link

Sorry to post in a closed issue, but for anyone else having issues with bundle install from capistrano, add the following line to deploy.rb:

set :bundle_cmd, "LANG='en_US.UTF-8' LC_ALL='en_US.UTF-8' bundle"

@evanrmurphy
Copy link

@ndbroadbent Much obliged! I was having this issue with capistrano, and your snippet fixed it.

@pi3r
Copy link

pi3r commented Feb 24, 2012

@ndbroadbent Thanks man, you saved my day!

@krisleech
Copy link

set :default_environment, {
  'LANG' => 'en_US.UTF-8'
}

Credit: http://ruckus.tumblr.com/post/18613786601/bundler-install-error-argumenterror-invalid-byte

@sorentwo
Copy link

sorentwo commented Oct 1, 2012

Very pleased to find this issue. Was entirely unaware of the LC_ALL environment variable before.

@wuzhefang
Copy link

@JangoSteve Thanks

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

Successfully merging this pull request may close these issues.