Vagrant: incompatible character encodings: CP850 and Windows-1252

Created on 30 May 2014  Â·  27Comments  Â·  Source: hashicorp/vagrant

When the user profile directory has accent, vagrant opens its beak, he can not read environment variables, because some of them are pulling something from the user profile directory it can not convert the charset

C:\Users\Hélio\Downloads>vagrant box add sonbox.box
C:/HashiCorp/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:224:in join': incompatible character encodings: CP850 and Windows-1252 (Encoding::Compatibil ityError) from C:/HashiCorp/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtim e.rb:224:insetup_environment'
from C:/HashiCorp/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtim
e.rb:15:in setup' from C:/HashiCorp/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler.rb:127 :insetup'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.6.2/bin/vagrant:71:in
`

'

Most helpful comment

I fixed this issue by using the command above

set VAGRANT_HOME=C:\HashiCorp\Vagrant

AND

Changing the default VM folder on VirtualBox preferences

All 27 comments

+1 - Maybe the 'é' in Hélio user?

that's right, but it is still a bug

2014-06-27 16:23 GMT-03:00 insign [email protected]:

+1 - Maybe the 'é' in Hélio user?

—
Reply to this email directly or view it on GitHub
https://github.com/mitchellh/vagrant/issues/3937#issuecomment-47390182.

This bug is very annoying, do I have to create a new windows user profile for running vagrant? Or is there a workaround? My User has a "ä" in the name and I have the same problem.

I created a new user and works
Em 06/07/2014 06:24, "Sixtisam" [email protected] escreveu:

This bug is very annoying, do I have to create a new windows user profile
for running vagrant? Or is there a workaround? My User has a "ä" in the name

—
Reply to this email directly or view it on GitHub
https://github.com/mitchellh/vagrant/issues/3937#issuecomment-48106923.

I am having the same issue with my Russian username. Only in my case the encodings are IBM866 and Windows-1251.
I've done some debugging and found out that the problem is in ENV['GEM_HOME'] value — it contains the username encoded in what appears to be UTF-8 yet the string's #encoding returns "ASCII-8BIT". Ruby cannot join it with the others.
When I tried to find where the misencoded string comes from, I got lost :)

yes, just need fix this line in ruby file.
but a don`t know nothing about ruby...

2014-07-17 12:40 GMT-03:00 Ilya Vassilevsky [email protected]:

I am having the same issue with my Russian username. Only in my case the
encodings are IBM866 and Windows-1251.
I've done some debugging and found out that the problem is in
ENV['GEM_HOME'] value — it contains the username encoded in what appears
to be UTF-8 yet the string's #encoding returns "ASCII-8BIT". Ruby cannot
join it with the others.
When I tried to find where the misencoded string comes from, I got lost :)

—
Reply to this email directly or view it on GitHub
https://github.com/mitchellh/vagrant/issues/3937#issuecomment-49324244.

A quick hack would be to modify the first few lines in c:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\bin\vagrant:

#!/usr/bin/env ruby

Encoding.default_external = Encoding.find('Windows-1250')
Encoding.default_internal = Encoding.find('Windows-1250')

# Trap interrupts to quit cleanly. This will be overridden at some point
# by Vagrant. This is made to catch any interrupts while Vagrant is
# initializing which have historically resulted in stack traces.

etc.

Don't forget to replace the string in the findwith the second encoding in your error message, e.g. Windows-1252 in your case

Note that this will also mean that your vagrant files might break if they contain characters that are not in the specified encoding, but all-ASCII files should be okay.

Quick Note: On Windows 7 the appropriate character encoding seems to be Windows-1252

I don't get the encoding error anymore, but:

Vagrant failed to initialize at a very early stage:

The home directory you specified is not accessible. The home
directory that Vagrant uses must be both readable and writable.

You specified: C:/Users

How do I change the home directory?

I'm running a fresh Vagrant 1.6.3 installation on Win7 (64Bit).

@Anticom if you just call vagrant as the administrator user it will work, just pollute your /c/Users directory a bit.

@sztupy My own account has admin permissions. :open_mouth:

4159 fixes that

@Anticom if you have UAC turned on then no, you don't

@sztupy Oh okay. And you are saying, that if i boot a vagrant VM as admin it will work lateron on my account?

This is a dupe of #2113. We're still not sure how to fix this yet. :(

please fix this

Hi @luisrudge - we would love to fix it, but we don't have a good solution yet :frowny:

what about chcp 1252 on the command line?

image

@Anticom I had set up system variable VAGRANT_HOME where specify path to my vagrant project (where i have rw access)

Solved this bug, just set VAGRANT_HOME variable in CMD like this:
set VAGRANT_HOME=C:\HashiCorp\Vagrant

This patch C:\HashiCorp\Vagrant by default install vagrant. Worked for me (OS Windows 8.1 x64)

I fixed this issue by using the command above

set VAGRANT_HOME=C:\HashiCorp\Vagrant

AND

Changing the default VM folder on VirtualBox preferences

@andreroggeri this fixed for me too, my user name has an "é" character in it as well, so vagrant was probably bugging when checking the default vm folder wich was located under the "users/myusérname" folder, i just changed it to a generic folder "C:\VMs" and it worked.

Please!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! someone help me with this error? JESSICA-PC@JESSICA MINGW64 ~/desktop/blog/projeto (master)
$ git add --all

JESSICA-PC@JESSICA MINGW64 ~/desktop/blog/projeto (master)
$ git commit -m "ajustes no bootstrap"
[master af559d8] ajustes no bootstrap
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 index.html
create mode 100644 scss/vendors/plugins.scss

JESSICA-PC@JESSICA MINGW64 ~/desktop/blog/projeto (master)
$ sass --no-cache --watch scss:css --style compressed

Sass is watching for changes. Press Ctrl-C to stop.
directory css/vendors
write css/vendors/plugins.css
write css/vendors/plugins.css.map
Encoding::CompatibilityError: incompatible character encodings: Windows-1252 and CP850
Use --trace for backtrace.

@andreroggeri 👍

amazing that this command fixed my vagrant bug with my name = Stéphane "é"
with this on my folder = set VAGRANT_HOME=C:\HashiCorp\Vagrant
The issue is gone. Is vagrant making an update for the new updates?

I had to revert to 1.8.7 as 1.9 seems to have issues on Windows with curl and I couldn't fix that.
The set VAGRANT_HOME=C:\HashiCorp\Vagrant fix works, but I had to run vagrant up from a command prompt with admin rights.
Guys, it would be really great if you could test vagrant on Windows before publishing it.

Got this issue with version 2.0.4, could get it running with the solutions from this forum.

set VAGRANT_HOME=C:\HashiCorp
and
have moved VirtualBox path from users directory to c:\Virtual Box VMs

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings