Error message given during initialization incompatible character encodings ibm866 and windows 1251

Ошибка кодирования Vagrant Windows-1251 Я получил следующую ошибку с бродягой при попытке использовать команду «vagrant up»: У меня Windows 8.1, и раньше я использовал команду «chcp 1251», потому что это была ошибка с кодировкой «ibm866». Проблема была решена путем установки переменной окружения VAGRANT_HOME Установите переменную VAGRANT_HOME в путь, например ‘ c:HashiCorp ‘ Затем добавьте […]

Содержание

  1. Ошибка кодирования Vagrant Windows-1251
  2. Problem Windows 8.1 incompatible character encodings: IBM866 and ASCII-8BIT #2763
  3. Comments
  4. Footer
  5. Как решить проблему с кодировкой в vagrant?
  6. Vagrant error: incompatible character encodings: Windows-1250 and CP852 (Encoding::CompatibilityError) #12290
  7. Comments
  8. Vagrant version
  9. Host operating system
  10. Guest operating system
  11. Vagrantfile
  12. Debug output
  13. Expected behavior
  14. Actual behavior
  15. Steps to reproduce
  16. References
  17. Footer
  18. windows encoding problem #5475
  19. Comments

Ошибка кодирования Vagrant Windows-1251

Я получил следующую ошибку с бродягой при попытке использовать команду «vagrant up»:

У меня Windows 8.1, и раньше я использовал команду «chcp 1251», потому что это была ошибка с кодировкой «ibm866».

Проблема была решена путем установки переменной окружения VAGRANT_HOME

Установите переменную VAGRANT_HOME в путь, например ‘ c:HashiCorp ‘

Затем добавьте в c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant после #!/usr/bin/env ruby эти две строки:

Обратите внимание на Windows-1251 , а не на Windows-1250 .

И я думаю, вам может потребоваться перезагрузка, чтобы включить переменную окружения.

решение для меня было именно этим.

Вы должны перейти к: c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant

И отредактируйте бродягу (файл) и поставьте после этого: #!/usr/bin/env ruby

Если у вас есть проблемы с этим, даже после установки переменной env, попробуйте просто переместить папку «homestead» в путь, который не содержит никаких кириллических символов. Или вы можете создать другого пользователя в вашей системе без cyrilc Надеюсь, это поможет!

Да, настройка переменной среды VAGRANT_HOME может решить проблему.

Я думаю, что в основном потому, что команда %userprofile%.vagrant.d vagrant up попытается посетить %userprofile%.vagrant.d , однако ваш %userprofile% назван в кодировке Windows 1251 . Установка VAGRANT_HOME может указывать на путь, распознаваемый для бродячего рубинового скрипта.

Источник

Problem Windows 8.1 incompatible character encodings: IBM866 and ASCII-8BIT #2763

D:Devrails-dev-box-master>vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider.
[default] Box ‘precise32’ was not found. Fetching box from specified URL for
the provider ‘virtualbox’. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading box from URL: http://files.vagrantup.com/precise32.box
C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/childprocess/wind
ows/process_builder.rb:63:in join’: incompatible character encodings: IBM866 an d ASCII-8BIT (Encoding::CompatibilityError) from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil dprocess/windows/process_builder.rb:63:in create_environment_pointer’
from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil
dprocess/windows/process_builder.rb:28:in start’ from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil dprocess/windows/process.rb:63:in launch_process’
from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil
dprocess/abstract_process.rb:72:in start’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/subprocess.rb:105:in block in execute’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/safe_chdir.rb:26:in block (2 levels) in safe_chdir’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/safe_chdir.rb:25:in chdir’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/safe_chdir.rb:25:in block in safe_chdir’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/safe_chdir.rb:24:in synchronize’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/safe_chdir.rb:24:in safe_chdir’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/subprocess.rb:104:in execute’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/subprocess.rb:24:in execute’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/downloader.rb:133:in block in download!’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/busy.rb:19:in busy’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/downloader.rb:132:in download!’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/box_add.rb:191:in download_box_url’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/box_add.rb:74:in block in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/box_add.rb:72:in each’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/box_add.rb:72:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/warden.rb:34:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builder.rb:116:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/runner.rb:69:in block in run’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/busy.rb:19:in busy’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/runner.rb:69:in run’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/handle_box_url.rb:73:in block in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/handle_box_url.rb:56:in synchronize’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/handle_box_url.rb:56:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/warden.rb:34:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:95:in block in finalize_action’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/warden.rb:34:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:34:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builder.rb:116:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in block in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/busy.rb:19:in busy’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/call.rb:51:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:34:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/plugins/provi
ders/virtualbox/action/check_virtualbox.rb:17:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:34:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builder.rb:116:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in block in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/busy.rb:19:in busy’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/m
achine.rb:147:in action’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/b atch_action.rb:63:in block (2 levels) in run’

The text was updated successfully, but these errors were encountered:

Works if change the encoding of 1251. On another computer with the same version works with 866. 🙁

Solved! Problem cyrillic user

How change the encoding?

I had set up system variable VAGRANT_HOME where specify path to my vagrant project (without cyrillic in path :))

The problem was my PS1 string (I use Git Bash) with some Unicode swag.. Are there any chances this can be fixed in Vagrant?

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Как решить проблему с кодировкой в vagrant?

Простой 9 комментариев

ACP это из древнегречeского ^W мелкомягкого такое важное слово из трех букв
https://knowledgebase.progress.com/articles/Articl.

может быть плохой идеей использовать поддержку национального языка в Vagrant, который AFAIK, который tries to be os independent .

UTF 8 это то что Ruby вероятно прожует зато Windows подавится.

для редактирования source of vagrant скрипта ничего особенно делать не надо надо только его найти:

это выполнено из гит баж

то же из под него родимого
— сохранил

У меня была аналогичная проблема и помогло решение со стека.

Конечно же Вы не нашли путь c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant, так как у Вас версия vagrant 2.2.3 и соответственно путь: C:HashiCorpVagrantembeddedgems2.2.3gemsvagrant-2.2.3binvagrant.

Чтобы отредактировать данный файл, я бы рекомендовал открыть его от имени администратора Windows в текстовом редакторе вроде Notepad++. Далее примерный перевод и копипаста:

1. Установите переменную окружения VAGRANT_HOME , например ‘c:HashiCorp‘;
2. В файле C:HashiCorpVagrantembeddedgems2.2.3gemsvagrant-2.2.3binvagrant после #!/usr/bin/env добавить две строки:

Важно Windows-1251, а не Windows-1250.
Думаю также может потребоваться перезагрузка для применения переменной окружения.

Источник

Vagrant error: incompatible character encodings: Windows-1250 and CP852 (Encoding::CompatibilityError) #12290

Vagrant version

Host operating system

Microsoft Windows 10 Pro / Polish

Guest operating system

Vagrantfile

Debug output

Expected behavior

Actual behavior

You get an error:

C:/HashiCorp/Vagrant/embedded/gems/2.2.15/gems/vagrant-2.2.15/plugins/commands/up/middleware/store_box_metadata.rb:23:in `sub’: incompatible character encodings: Windows-1250 and CP852 (Encoding::CompatibilityError)

Steps to reproduce

  1. Install Vagrant 2.2.15 in Win 10 Pro / polish
  2. Try to do vagrant up

References

The text was updated successfully, but these errors were encountered:

OK.
So my solution to fix this was:

  1. Open file: C:HashiCorpVagrantembeddedgems2.2.15gemsvagrant-2.2.15binvagrant
  2. Add these lines:
  1. Set VAGRANT_HOME variable using command line interpreter:

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.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

windows encoding problem #5475

The text was updated successfully, but these errors were encountered:

Sorry you are having problems. Is there any more information in the stacktrace? That error looks to be coming from Bundler.

The reason of my problem is the availability Cyrillic symbols in file path. To solve this problem I moved the project to other folder so that the Cyrillic characters didn’t meet in the file path.

But may be the reason of this error is vagrant.

Compiling all these into #5896

@Tanyusha Hi, I’m looking into encoding issues related to Vagrant. If you’ve still got the setup, would you mind running the following script with the Ruby interpreter provided in C:/HashiCorp/Vagrant/

This will help us debug the issue. Although it’s actually caused by this line of code. I should be able to fix it without your path information, but it’d be useful for you to provide a repro case if you can.

On windows systems with windows-1251 encodings these lines of code cause the bug.

In Ruby, strings have utf-8 as their default encoding. Coming off the shell, the string will have a windows-1251 encoding. Consider the following array literal:

This is something akin (encoding wise) to what bundler will produce, as PATH has the windows encoding, and the bundler path is unshifted to it.

Attempting to call .join with File::PATH_SEPARATOR will raise because join does not attempt to coerce strings into compatible encodings. The solution here is to map utf-8 encoding first over the array.

@mitchellh I’m going to go ahead and submit a patch to bundler to get this sorted.

Источник

I got the next error with vagrant when trying to use «vagrant up» command:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'precise32'...
C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.5.3/lib/childprocess/wind
ows/process_builder.rb:43:in `join': incompatible character encodings: Windows-1
251 and UTF-8 (Encoding::CompatibilityError)

I have Windows 8.1, and I used «chcp 1251» command before, because it was the same error with «ibm866» encoding.

Thanks!

asked Sep 28, 2014 at 15:25

drmckay-'s user avatar

2

Problem was solved by setting environment variable VAGRANT_HOME

answered Sep 29, 2014 at 14:40

drmckay-'s user avatar

drmckay-drmckay-

2151 gold badge2 silver badges11 bronze badges

the solution for me was this one .

You have to go to : c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant

And edit the vagrant (file) and put after this : #!/usr/bin/env ruby

this 2 lines

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

Good luck!

zkanoca's user avatar

zkanoca

9,4449 gold badges48 silver badges94 bronze badges

answered Nov 18, 2014 at 21:43

Dexpo's user avatar

DexpoDexpo

914 bronze badges

  1. Set an environtment variable VAGRANT_HOME to the path, for example ‘c:HashiCorp

  2. Then add to c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant after #!/usr/bin/env ruby these two lines:

Encoding.default_external = Encoding.find('Windows-1251')

Encoding.default_internal = Encoding.find('Windows-1251')

Notice Windows-1251, not Windows-1250.

And I think you might need to reboot to enable the environment variable.

zkanoca's user avatar

zkanoca

9,4449 gold badges48 silver badges94 bronze badges

answered Aug 19, 2015 at 6:08

Gulzada Serzhan's user avatar

1

Yes, setting environment variable VAGRANT_HOME can solve the problem.

I think it’s mainly because vagrant up command would try to visit %userprofile%.vagrant.d folder, however, your %userprofile% is named in Windows 1251 encoding. Setting VAGRANT_HOME can point to a path recognizable for vagrant’s ruby script.

answered Apr 24, 2015 at 3:00

IronBlood's user avatar

If you stil having some trouble with it, even after seting env variable, try just to move your «homestead» folder to a path that not contains any cyrilic symbols.
Or you can create another user in you system without cyrilc
Hope it helps!

answered Jan 23, 2017 at 20:05

den_ban's user avatar

Содержание

  1. Как решить проблему с кодировкой в vagrant?
  2. Problem Windows 8.1 incompatible character encodings: IBM866 and ASCII-8BIT #2763
  3. Comments
  4. ariutk commented Jan 5, 2014
  5. ariutk commented Jan 5, 2014
  6. Vagrant Windows-1251 encoding error
  7. 5 Answers 5
  8. Not the answer you’re looking for? Browse other questions tagged vagrant or ask your own question.
  9. Related
  10. Hot Network Questions
  11. Subscribe to RSS
  12. Ошибка кодирования Vagrant Windows-1251
  13. windows encoding problem #5475
  14. Comments
  15. Tanyusha commented Mar 13, 2015
  16. sethvargo commented Mar 17, 2015
  17. Tanyusha commented Mar 22, 2015
  18. mitchellh commented Jul 7, 2015
  19. penelopezone commented Sep 8, 2015
  20. penelopezone commented Oct 7, 2015

Как решить проблему с кодировкой в vagrant?

Простой 9 комментариев

5caa4bae536df606786608

5caa4bae536df606786608

5c44ac70b4b68628885967ACP это из древнегречeского ^W мелкомягкого такое важное слово из трех букв
https://knowledgebase.progress.com/articles/Articl.

UTF 8 это то что Ruby вероятно прожует зато Windows подавится.

5caa4bae536df606786608

5c44aef1a293c965797933для редактирования source of vagrant скрипта ничего особенно делать не надо надо только его найти:

это выполнено из гит баж

то же из под него родимого
— сохранил

5caa4bae536df606786608

5caa4bae536df606786608

59d3eb810a967173092578

У меня была аналогичная проблема и помогло решение со стека.

Конечно же Вы не нашли путь c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant, так как у Вас версия vagrant 2.2.3 и соответственно путь: C:HashiCorpVagrantembeddedgems2.2.3gemsvagrant-2.2.3binvagrant.

Чтобы отредактировать данный файл, я бы рекомендовал открыть его от имени администратора Windows в текстовом редакторе вроде Notepad++. Далее примерный перевод и копипаста:

Важно Windows-1251, а не Windows-1250.
Думаю также может потребоваться перезагрузка для применения переменной окружения.

Источник

Problem Windows 8.1 incompatible character encodings: IBM866 and ASCII-8BIT #2763

D:Devrails-dev-box-master>vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider.
[default] Box ‘precise32’ was not found. Fetching box from specified URL for
the provider ‘virtualbox’. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading box from URL: http://files.vagrantup.com/precise32.box
C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/childprocess/wind
ows/process_builder.rb:63:in join’: incompatible character encodings: IBM866 an d ASCII-8BIT (Encoding::CompatibilityError) from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil dprocess/windows/process_builder.rb:63:in create_environment_pointer’
from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil
dprocess/windows/process_builder.rb:28:in start’ from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil dprocess/windows/process.rb:63:in launch_process’
from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil
dprocess/abstract_process.rb:72:in start’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/subprocess.rb:105:in block in execute’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/safe_chdir.rb:26:in block (2 levels) in safe_chdir’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/safe_chdir.rb:25:in chdir’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/safe_chdir.rb:25:in block in safe_chdir’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/safe_chdir.rb:24:in synchronize’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/safe_chdir.rb:24:in safe_chdir’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/subprocess.rb:104:in execute’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/subprocess.rb:24:in execute’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/downloader.rb:133:in block in download!’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/busy.rb:19:in busy’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/downloader.rb:132:in download!’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/box_add.rb:191:in download_box_url’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/box_add.rb:74:in block in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/box_add.rb:72:in each’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/box_add.rb:72:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/warden.rb:34:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builder.rb:116:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/runner.rb:69:in block in run’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/busy.rb:19:in busy’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/runner.rb:69:in run’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/handle_box_url.rb:73:in block in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/handle_box_url.rb:56:in synchronize’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/handle_box_url.rb:56:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/warden.rb:34:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:95:in block in finalize_action’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/warden.rb:34:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:34:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builder.rb:116:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in block in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/busy.rb:19:in busy’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/call.rb:51:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:34:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/plugins/provi
ders/virtualbox/action/check_virtualbox.rb:17:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:34:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builder.rb:116:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in block in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/busy.rb:19:in busy’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/m
achine.rb:147:in action’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/b atch_action.rb:63:in block (2 levels) in run’

The text was updated successfully, but these errors were encountered:

Works if change the encoding of 1251. On another computer with the same version works with 866. 🙁

Источник

Vagrant Windows-1251 encoding error

I got the next error with vagrant when trying to use «vagrant up» command:

I have Windows 8.1, and I used «chcp 1251» command before, because it was the same error with «ibm866» encoding.

5 Answers 5

Problem was solved by setting environment variable VAGRANT_HOME

You have to go to : c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant

And edit the vagrant (file) and put after this : #!/usr/bin/env ruby

1SZog

PJnSX

Set an environtment variable VAGRANT_HOME to the path, for example ‘ c:HashiCorp ‘

Then add to c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant after #!/usr/bin/env ruby these two lines:

And I think you might need to reboot to enable the environment variable.

1SZog

Yes, setting environment variable VAGRANT_HOME can solve the problem.

I think it’s mainly because vagrant up command would try to visit %userprofile%.vagrant.d folder, however, your %userprofile% is named in Windows 1251 encoding. Setting VAGRANT_HOME can point to a path recognizable for vagrant’s ruby script.

If you stil having some trouble with it, even after seting env variable, try just to move your «homestead» folder to a path that not contains any cyrilic symbols. Or you can create another user in you system without cyrilc Hope it helps!

Not the answer you’re looking for? Browse other questions tagged vagrant or ask your own question.

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2022.11.5.40657

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Ошибка кодирования Vagrant Windows-1251

Я получил следующую ошибку с бродягой при попытке использовать команду «vagrant up»:

У меня Windows 8.1, и раньше я использовал команду «chcp 1251», потому что это была ошибка с кодировкой «ibm866».

points

Проблема была решена путем установки переменной окружения VAGRANT_HOME

points

Затем добавьте c: HashiCorp Vagrant embedded gems gems vagrant-1.6.3 bin vagrant после #!/usr/bin/env Ruby эти две строки:

Encoding.default_internal = Encoding.find (‘Windows-1251’)

И я думаю, вам может потребоваться перезагрузка, чтобы включить переменную окружения.

points

решение для меня было именно этим.

You have to go to : c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant

And edit the vagrant (file) and put after this : #!/usr/bin/env ruby

points

Да, настройка переменной среды VAGRANT_HOME может решить проблему.

points

Если у вас есть проблемы с этим, даже после установки переменной env, попробуйте просто переместить папку «homestead» в путь, который не содержит никаких кириллических символов. Или вы можете создать другого пользователя в вашей системе без cyrilc Надеюсь, поможет!

Источник

windows encoding problem #5475

The text was updated successfully, but these errors were encountered:

Sorry you are having problems. Is there any more information in the stacktrace? That error looks to be coming from Bundler.

The reason of my problem is the availability Cyrillic symbols in file path. To solve this problem I moved the project to other folder so that the Cyrillic characters didn’t meet in the file path.

But may be the reason of this error is vagrant.

Compiling all these into #5896

@Tanyusha Hi, I’m looking into encoding issues related to Vagrant. If you’ve still got the setup, would you mind running the following script with the Ruby interpreter provided in C:/HashiCorp/Vagrant/

This will help us debug the issue. Although it’s actually caused by this line of code. I should be able to fix it without your path information, but it’d be useful for you to provide a repro case if you can.

On windows systems with windows-1251 encodings these lines of code cause the bug.

In Ruby, strings have utf-8 as their default encoding. Coming off the shell, the string will have a windows-1251 encoding. Consider the following array literal:

This is something akin (encoding wise) to what bundler will produce, as PATH has the windows encoding, and the bundler path is unshifted to it.

@mitchellh I’m going to go ahead and submit a patch to bundler to get this sorted.

Источник

Я получил следующую ошибку с vagrant при попытке использовать команду «vagrant up»:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'precise32'...
C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.5.3/lib/childprocess/wind
ows/process_builder.rb:43:in `join': incompatible character encodings: Windows-1
251 and UTF-8 (Encoding::CompatibilityError)

У меня Windows 8.1, и раньше я использовал команду «chcp 1251», потому что это была та же ошибка с кодировкой «ibm866».

Благодарность!

4 ответа

Лучший ответ

Проблема была решена установкой переменной окружения VAGRANT_HOME


9

drmckay-
29 Сен 2014 в 18:40

Решение для меня было этим.

Вам нужно перейти на: c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant

И отредактируйте бродягу (файл) и поставьте после этого: #!/usr/bin/env ruby

Это 2 строки

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

Удачи!


8

zkanoca
15 Сен 2015 в 16:13

Да, установка переменной среды VAGRANT_HOME может решить проблему.

Я думаю, это главным образом потому, что команда vagrant up попытается посетить папку %userprofile%.vagrant.d, однако ваш %userprofile% назван в кодировке Windows 1251. Параметр VAGRANT_HOME может указывать на путь, распознаваемый скриптом ruby ​​vagrant.


0

IronBlood
24 Апр 2015 в 06:00

Если у вас все еще возникли проблемы с этим, даже после установки переменной env, попробуйте просто переместить вашу папку «homestead» на путь, который не содержит никаких кириллических символов. Или вы можете создать другого пользователя в своей системе без cyrilc. Надеюсь, это поможет!


0

den_ban
23 Янв 2017 в 23:05

Я получил следующую ошибку с бродягой при попытке использовать команду «vagrant up»:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'precise32'...
C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.5.3/lib/childprocess/wind
ows/process_builder.rb:43:in 'join': incompatible character encodings: Windows-1
251 and UTF-8 (Encoding::CompatibilityError)

У меня Windows 8.1, и раньше я использовал команду «chcp 1251», потому что это была ошибка с кодировкой «ibm866».

Благодарю!

Проблема была решена путем установки переменной окружения VAGRANT_HOME

Установите переменную VAGRANT_HOME в путь, например ‘ c:HashiCorp

Затем добавьте в c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant после #!/usr/bin/env ruby эти две строки:

Encoding.default_external = Encoding.find('Windows-1251')

Encoding.default_internal = Encoding.find('Windows-1251')

Обратите внимание на Windows-1251, а не на Windows-1250.

И я думаю, вам может потребоваться перезагрузка, чтобы включить переменную окружения.

решение для меня было именно этим.

Вы должны перейти к: c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant

И отредактируйте бродягу (файл) и поставьте после этого: #!/usr/bin/env ruby

это 2 строки

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

Удачи!

Если у вас есть проблемы с этим, даже после установки переменной env, попробуйте просто переместить папку «homestead» в путь, который не содержит никаких кириллических символов. Или вы можете создать другого пользователя в вашей системе без cyrilc Надеюсь, это поможет!

Да, настройка переменной среды VAGRANT_HOME может решить проблему.

Я думаю, что в основном потому, что команда %userprofile%.vagrant.d vagrant up попытается посетить %userprofile%.vagrant.d, однако ваш %userprofile% назван в кодировке Windows 1251. Установка VAGRANT_HOME может указывать на путь, распознаваемый для бродячего рубинового скрипта.

Введите минимум 50 символов

Содержание

  1. Incompatible character encodings: UTF-8 and IBM866 (Encod ing::CompatibilityError)
  2. Как решить проблему с кодировкой в vagrant?
  3. Vagrant Windows-1251 encoding error
  4. 5 Answers 5
  5. Not the answer you’re looking for? Browse other questions tagged vagrant or ask your own question.
  6. Related
  7. Hot Network Questions
  8. Subscribe to RSS
  9. Problem Windows 8.1 incompatible character encodings: IBM866 and ASCII-8BIT #2763
  10. Comments
  11. ariutk commented Jan 5, 2014
  12. ariutk commented Jan 5, 2014
  13. Ruby incompatible character encodings
  14. 1 Answer 1

Incompatible character encodings: UTF-8 and IBM866 (Encod ing::CompatibilityError)

Всем привет. Приступил к изучению Ruby, сразу предупреждаю я абсолютный 0. к программированию вообще никакого отношения не имел.

Начал изучать по книге Криса Пайна «Учись программировать» и. попал в ситуации которые не описаны в учебнике, ситуации кодировкой. С первой проблемой я справился сохранив файл в кодировке UTF-8

это решение не помогло при следующих задачах приведенных в учебнике. Вот что пишет комп:

calc.rb:3:in ` ‘: incompatible character encodings: UTF-8 and IBM866 (Encod
ing::CompatibilityError)

помогите с этим справится..

[C++ Warning] Unit1.cpp(270): W8098 Multi-character character constant
//транслит String translit(String tb) < for(int i=1; i 9

а вообще руби не самый лучший вариант для первого языка

а вообще руби не самый лучший вариант для первого языка

это не помогло

Добавлено через 15 минут
странно что первая часть кода:

работает нормально и отображается,

так же работает и

Добавлено через 4 минуты
это

это не работает

Это только мое имхо, но начинать программную жизнь с ОО языка не есть хорошо. В руби много «магии» для новичка, а если уйти в рор то может сложится впечатление, что это делал Гендальф. Начинать стоит с pure C, пройти через С++, потом желательно через фп язык (lisp или haskel) и уж тогда на руби. Но это только идеал, писающий радугой и отрыгивающий бабочками.

ТС, я даже не подумал что у вас шиндовс. Если таки хотите разрабатывать на руби — ставьте линукс (или покупайте мак )

вспомнился анекдот:
Приехал сын на деревню из армии. Утром собрались они с отцом за дровами. Идут значит с утра и отец решил сына расспросить об том как служба сейчас в современных войсках.
(О) — Ну ка сын, расскажи как там щас!
(С) — Хорошо отец щас на примере покажу. Вот мы идем за дровами — это «задача». А условия заданные командиром это «вводные». Так вот, (приближаясь они в речке которую надо по моту перейти), вводная — моста нет.
(О) — как нет?! Вот же он сына.
(С) — Я сказал что это вводная. Что моста нет. Это приказ и он не обсуждается.
(О) — Ладно сына, я понял. И что делать?!
(С) — что, что — задачу выполнять.
(О) — ну тогда в брод на телеге переберемся.

Нарубили они дров и только давай грузить на телегу,
(С) — новая вводная — телеги нет. Противник уничтожил транспорт авиа ударом.
(О) — как нет! Так вот же она. 🙁
(С) — я сказал же что это вводная.
__________________________________
В общем сам анекдот не важен как то что:
(ТС) — Задача, изучить Ruby. Вводные — есть инет и нетбук с Windows7 🙂 Денег на Мак нет, Люнекс для пренесет другие трудности, т.к. я его не знаю.

EugenyT, вот вам пример, как с небольшими неудобствами работать с кирилическими литералами в windows (уверен, что найдутся лучшие способы, но для начала сгодится):

Как решить проблему с кодировкой в vagrant?

ACP это из древнегречeского ^W мелкомягкого такое важное слово из трех букв
https://knowledgebase.progress.com/articles/Articl.

может быть плохой идеей использовать поддержку национального языка в Vagrant, который AFAIK, который tries to be os independent .

UTF 8 это то что Ruby вероятно прожует зато Windows подавится.

для редактирования source of vagrant скрипта ничего особенно делать не надо надо только его найти:

это выполнено из гит баж

то же из под него родимого
— сохранил

У меня была аналогичная проблема и помогло решение со стека.

Конечно же Вы не нашли путь c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant, так как у Вас версия vagrant 2.2.3 и соответственно путь: C:HashiCorpVagrantembeddedgems2.2.3gemsvagrant-2.2.3binvagrant.

Чтобы отредактировать данный файл, я бы рекомендовал открыть его от имени администратора Windows в текстовом редакторе вроде Notepad++. Далее примерный перевод и копипаста:

1. Установите переменную окружения VAGRANT_HOME , например ‘c:HashiCorp‘;
2. В файле C:HashiCorpVagrantembeddedgems2.2.3gemsvagrant-2.2.3binvagrant после #!/usr/bin/env добавить две строки:

Важно Windows-1251, а не Windows-1250.
Думаю также может потребоваться перезагрузка для применения переменной окружения.

Vagrant Windows-1251 encoding error

I got the next error with vagrant when trying to use «vagrant up» command:

I have Windows 8.1, and I used «chcp 1251» command before, because it was the same error with «ibm866» encoding.

5 Answers 5

Problem was solved by setting environment variable VAGRANT_HOME

the solution for me was this one .

You have to go to : c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant

And edit the vagrant (file) and put after this : #!/usr/bin/env ruby

Set an environtment variable VAGRANT_HOME to the path, for example ‘ c:HashiCorp ‘

Then add to c:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant after #!/usr/bin/env ruby these two lines:

Notice Windows-1251 , not Windows-1250 .

And I think you might need to reboot to enable the environment variable.

Yes, setting environment variable VAGRANT_HOME can solve the problem.

I think it’s mainly because vagrant up command would try to visit %userprofile%.vagrant.d folder, however, your %userprofile% is named in Windows 1251 encoding. Setting VAGRANT_HOME can point to a path recognizable for vagrant’s ruby script.

If you stil having some trouble with it, even after seting env variable, try just to move your «homestead» folder to a path that not contains any cyrilic symbols. Or you can create another user in you system without cyrilc Hope it helps!

Not the answer you’re looking for? Browse other questions tagged vagrant or ask your own question.

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Problem Windows 8.1 incompatible character encodings: IBM866 and ASCII-8BIT #2763

D:Devrails-dev-box-master>vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider.
[default] Box ‘precise32’ was not found. Fetching box from specified URL for
the provider ‘virtualbox’. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading box from URL: http://files.vagrantup.com/precise32.box
C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/childprocess/wind
ows/process_builder.rb:63:in join’: incompatible character encodings: IBM866 an d ASCII-8BIT (Encoding::CompatibilityError) from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil dprocess/windows/process_builder.rb:63:in create_environment_pointer’
from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil
dprocess/windows/process_builder.rb:28:in start’ from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil dprocess/windows/process.rb:63:in launch_process’
from C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.3.9/lib/chil
dprocess/abstract_process.rb:72:in start’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/subprocess.rb:105:in block in execute’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/safe_chdir.rb:26:in block (2 levels) in safe_chdir’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/safe_chdir.rb:25:in chdir’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/safe_chdir.rb:25:in block in safe_chdir’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/safe_chdir.rb:24:in synchronize’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/safe_chdir.rb:24:in safe_chdir’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/subprocess.rb:104:in execute’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/subprocess.rb:24:in execute’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/downloader.rb:133:in block in download!’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/busy.rb:19:in busy’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/downloader.rb:132:in download!’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/box_add.rb:191:in download_box_url’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/box_add.rb:74:in block in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/box_add.rb:72:in each’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/box_add.rb:72:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/warden.rb:34:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builder.rb:116:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/runner.rb:69:in block in run’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u til/busy.rb:19:in busy’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/runner.rb:69:in run’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/handle_box_url.rb:73:in block in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/handle_box_url.rb:56:in synchronize’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/builtin/handle_box_url.rb:56:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/warden.rb:34:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:95:in block in finalize_action’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/warden.rb:34:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:34:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builder.rb:116:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in block in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/busy.rb:19:in busy’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builtin/call.rb:51:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:34:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/plugins/provi
ders/virtualbox/action/check_virtualbox.rb:17:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/warden.rb:34:in call’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a
ction/builder.rb:116:in call’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in block in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/u
til/busy.rb:19:in busy’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/a ction/runner.rb:69:in run’
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/m
achine.rb:147:in action’ from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.2/lib/vagrant/b atch_action.rb:63:in block (2 levels) in run’

The text was updated successfully, but these errors were encountered:

Works if change the encoding of 1251. On another computer with the same version works with 866. 🙁

Ruby incompatible character encodings

I am currently trying to write a script that iterates over an input file and checks data on a website. If it finds the new data, it prints out to the terminal that it passes, if it doesn’t it tells me it fails. And vice versa for deleted data. It was working fine until the input file I was given contains the «™» character. Then when ruby gets to that line, it is spitting out an error:

PDAPWeb.rb:73:in `include?’: incompatible character encodings: UTF-8 and IBM437 (Encoding::CompatibilityError)

The offending line is a simple check to see if the text exists on the page.

Where the program_name variable is a parsed piece of information from the input file. In this instance, the program_name contains the ‘TM’ character mentioned before.

After some research I found that adding the line # encoding: utf-8 to the beginning of my script could help, but so far has not proven useful.

I added this to my program_name variable to see if it would help(and it allowed my script to run without errors), but now it is not properly finding the TM character when it should be.

This seemed to convert the TM character to this: Γäó

I thought maybe i had IBM437 and utf-8 parts reversed, so I tried the opposite

and am now receiving this error when attempting to run the script

PDAPWeb.rb:48:in `encode’: U+2122 from UTF-8 to IBM437 (Encoding::UndefinedConve rsionError)

I am using ruby 1.9.3p392 (2013-02-22) and I’m not sure if I should upgrade as this is the standard version installed in my company.

Is my encoding incorrect and causing it to convert the TM character with errors?

1 Answer 1

Here’s what it looks like is going on. Your input file contains a ™ character, and it is in UTF-8 encoding. However when you read it, since you don’t specify the encoding, Ruby assumes it is in your system’s default encoding of IBM437 (you must be on Windows).

This is basically the same as this:

Note that force_encoding doesn’t change the actual string, just the label associated with it. This is the same outcome as in your case, only you arrive here via a different route (by reading the file).

The web page also has a ™ symbol, and is also encoded as UTF-8, but in this case Ruby has the encoding correct (Watir probably uses the headers from the page):

Now when you try to compare these two strings you get the compatibility error, because they have different encodings:

If either of the two strings only contained ASCII characters (i.e. code points less that 128) then this comparison would have worked. Both UTF-8 and IBM437 are both supersets of ASCII, and are only incompatible if they both contain characters outside of the ASCII range. This is why you only started seeing this behaviour when the input file had a ™ .

The fix is to inform Ruby what the actual encoding of the input file is. You can do this with the already loaded string:

You can also do this when reading the file, e.g. (there are a few ways of reading files, they all should allow you to explicitly specify the encoding):

Note in both of these the string isn’t being changed, it still contains the same bytes, but Ruby now knows its correct encoding.

Now the comparison should work okay:

There is no need to encode the string. Here’s what happens if you do. First if you correct the encoding to UTF-8 then encode to IBM437:

IBM437 doesn’t include the ™ character, so you can’t encode a string containing it to this encoding without losing data. By default Ruby raises an exception when this happens. You can force the encoding by using the :undef option, but the symbol is lost:

If you go the other way, first using force_encoding to IBM437 then encoding to UTF-8 you get the string Γäó :

The string is already in IBM437 encoding as far as Ruby is concerned, so force_encoding doesn’t do anything. The UTF-8 representation of ™ is the three bytes 0xe2 0x84 0xa2 , and when interpreted as IBM437 these bytes correspond to the three characters seen here which are then converted into their UTF-8 representations.

(These two outcomes are the other way round from what you describe in the question, hence my comment above. I’m assuming that this is just a copy-and-paste error.)

0 / 0 / 0

Регистрация: 04.04.2012

Сообщений: 5

1

04.04.2012, 22:26. Показов 14252. Ответов 9


Всем привет. Приступил к изучению Ruby, сразу предупреждаю я абсолютный 0…. к программированию вообще никакого отношения не имел.

Начал изучать по книге Криса Пайна «Учись программировать» и….. попал в ситуации которые не описаны в учебнике, ситуации кодировкой. С первой проблемой я справился сохранив файл в кодировке UTF-8

это решение не помогло при следующих задачах приведенных в учебнике. Вот что пишет комп:

calc.rb:3:in `<main>’: incompatible character encodings: UTF-8 and IBM866 (Encod
ing::CompatibilityError)

помогите с этим справится..

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



SqREL

5 / 5 / 0

Регистрация: 15.12.2010

Сообщений: 20

05.04.2012, 01:24

2

Ruby
1
#encoding: UTF-8

в начало файла

а вообще руби не самый лучший вариант для первого языка



0



912 / 877 / 62

Регистрация: 06.01.2010

Сообщений: 2,367

Записей в блоге: 6

05.04.2012, 08:16

3

Придерживаюсь мнения, что руби — один из самых лучших вариантов для новичка.
Но вот разработка на нем в windows часто приносит огорчения, всё таки основная экосистема разработчиков сидят либо на маках, либо на линуксе.
С виндовой консолью для запуска руби-поделок вам еще придется натерпеться. Если вы только учитесь, старайтесь писать строковые литералы либо по английски, либо транслитом — и всё будет ОК.



0



EugenyT

0 / 0 / 0

Регистрация: 04.04.2012

Сообщений: 5

05.04.2012, 10:21

 [ТС]

4

Цитата
Сообщение от SqREL
Посмотреть сообщение

Ruby
1
#encoding: UTF-8

в начало файла

а вообще руби не самый лучший вариант для первого языка

это не помогло

Добавлено через 15 минут
странно что первая часть кода:

#encoding: UTF-8
puts ‘Приветик, ну и как Вас зовут?’
name = gets

работает нормально и отображается,

а далее нет.

так же работает и

puts gets

…..

Добавлено через 4 минуты
это

puts ‘Приветик, ну и как Вас зовут?’
name = ‘Евгений ‘
puts name + ‘это ваше полное имя?’

работает

это не работает

puts ‘Приветик, ну и как Вас зовут?’
name = gets
puts name + ‘это ваше полное имя?’



0



912 / 877 / 62

Регистрация: 06.01.2010

Сообщений: 2,367

Записей в блоге: 6

05.04.2012, 10:58

5

Цитата
Сообщение от EugenyT
Посмотреть сообщение

это работает

это не работает

Подозреваю, что gets возвращает строку в кодировке консоли, а она в винде — OEM (т.е. cp866), в то время как кодировка вашего исходника либо ANSI (cp1251), либо UTF-8 — в зависимости от того, что вы указали в заголовке. Вот интерпретатору и сносит голову от такого микса. В линуксе такого нет: там и консоль и всё остальное использует utf8.
Хорошей ссылкой по сабжу и его решению вас не снабжу, но гуглить примерно надо такое «ruby windows 866 1251»



0



0 / 0 / 0

Регистрация: 04.04.2012

Сообщений: 5

05.04.2012, 13:43

 [ТС]

6

спс за направление, но ответа так и не нашел…



0



5 / 5 / 0

Регистрация: 15.12.2010

Сообщений: 20

05.04.2012, 17:25

7

Это только мое имхо, но начинать программную жизнь с ОО языка не есть хорошо. В руби много «магии» для новичка, а если уйти в рор то может сложится впечатление, что это делал Гендальф. Начинать стоит с pure C, пройти через С++, потом желательно через фп язык (lisp или haskel) и уж тогда на руби. Но это только идеал, писающий радугой и отрыгивающий бабочками.

ТС, я даже не подумал что у вас шиндовс. Если таки хотите разрабатывать на руби — ставьте линукс (или покупайте мак )



0



EugenyT

05.04.2012, 18:15

 [ТС]

Не по теме:

вспомнился анекдот:
Приехал сын на деревню из армии. Утром собрались они с отцом за дровами. Идут значит с утра и отец решил сына расспросить об том как служба сейчас в современных войсках.
(О) — Ну ка сын, расскажи как там щас!
(С) — Хорошо отец щас на примере покажу. Вот мы идем за дровами — это «задача». А условия заданные командиром это «вводные». Так вот, (приближаясь они в речке которую надо по моту перейти), вводная — моста нет.
(О) — как нет?! Вот же он сына!…
(С) — Я сказал что это вводная!!! Что моста нет!!! Это приказ и он не обсуждается.
(О) — Ладно сына, я понял. И что делать?!
(С) — что, что — задачу выполнять!!!
(О) — ну тогда в брод на телеге переберемся…

Нарубили они дров и только давай грузить на телегу,
(С) — новая вводная — телеги нет. Противник уничтожил транспорт авиа ударом.
(О) — как нет! Так вот же она….. :(
(С) — я сказал же что это вводная…
__________________________________
В общем сам анекдот не важен как то что:
(ТС) — Задача, изучить Ruby. Вводные — есть инет и нетбук с Windows7 :) Денег на Мак нет, Люнекс для пренесет другие трудности, т.к. я его не знаю.



0



arni

912 / 877 / 62

Регистрация: 06.01.2010

Сообщений: 2,367

Записей в блоге: 6

05.04.2012, 20:46

9

EugenyT, вот вам пример, как с небольшими неудобствами работать с кирилическими литералами в windows (уверен, что найдутся лучшие способы, но для начала сгодится):

0) Устанавливаем FAR, если еще нет. Запускаем.
1) SHIFT+F4 — создание нового файла. Назовем test.rb
2) Если вверху окна редактора высветилось 1251, жмем F8, чтобы сменить на 866.
3) Набираем текст программы:

Ruby
1
2
3
4
#coding: cp866
puts 'Приветик, ну и как Вас зовут?'
name = gets
puts name + 'это ваше полное имя?'

4) Сохраняемся, и набираем в консоли

Код

ruby test.rb

5) Получаем результат (у меня работает на ruby 1.9.1):

Код

T:>ruby test.rb
Приветик, ну и как Вас зовут?
Царь!
Царь!
это ваше полное имя?



1



0 / 0 / 0

Регистрация: 04.04.2012

Сообщений: 5

06.04.2012, 12:15

 [ТС]

10

arni, вооо спасибо огромное, заработало!



0



+1 — Maybe the ‘é’ in Hélio user?

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 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:HashiCorpVagrantembeddedgemsgemsvagrant-1.6.3binvagrant:

#!/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. :(

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:HashiCorpVagrant

This patch C:HashiCorpVagrant 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:HashiCorpVagrant

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? [email protected] MINGW64 ~/desktop/blog/projeto (master)
$ git add —all

[email protected] 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

[email protected] 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.

amazing that this command fixed my vagrant bug with my name = Stéphane «é»
with this on my folder = set VAGRANT_HOME=C:HashiCorpVagrant
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:HashiCorpVagrant 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.

Понравилась статья? Поделить с друзьями:
  • Error message generator скачать
  • Error message generator online
  • Error message from server permission denied
  • Error message from server error invalid memory alloc request size
  • Error message for string length