Project

General

Profile

Actions

Bug #8508

closed

Invalid byte sequence in UTF-8 (ArgumentError) in win32/registry.rb

Added by thasmo (Thomas Deinhamer) almost 11 years ago. Updated about 10 years ago.

Status:
Closed
Assignee:
Target version:
-
ruby -v:
1.9.3
[ruby-core:55393]

Description

Hi guys!

I'm using Vagrant and the VMware workstation plugin to provision a VMware workstation VM
but in the end this doesn't work because I get an error in win32/registry.rb:

"C:/HashiCorp/Vagrant/embedded/lib/ruby/1.9.1/win32/registry.rb:173:in `tr': invalid byte sequence in UTF-8 (ArgumentError)"

The Vagrant debug log which includes the error trace can be found here:
https://gist.github.com/thasmo/12f88c7b1025aa5f2c32

The related Vagrant bug ticket can be found here:
https://github.com/mitchellh/vagrant/issues/1757#issuecomment-19175619

Please let me know if you need any further information on this!

Thanks a lot!

Updated by nobu (Nobuyoshi Nakada) almost 11 years ago

  • Category changed from platform/windows to M17N
  • Status changed from Open to Feedback
  • ruby -v changed from 1.9.1 to 1.9.3

That line in 1.9.1 is a comment, so it would be 1.9.3.

But why is Encoding.locale_charmap UTF-8 on Windows?
Are you using codepage 65001?

Updated by thasmo (Thomas Deinhamer) almost 11 years ago

Hi there!

Line 173 in the registry.rb file here on my PC is this one:
super msg.tr("\r", '').chomp

I'm sorry, I don't know how to set locale_charmap
and I'm not sure what a codepage is.

I'm running the App (Vagrant) using Cygwin on the mintty.exe terminal.

If you wanna tell me how to find out the codepage I can provide you with that info.

Thank you!

Updated by thasmo (Thomas Deinhamer) almost 11 years ago

It actually seems this only happens when using Cygwin with the mintty.exe terminal.
Any idea how to solve this?

Updated by thasmo (Thomas Deinhamer) almost 11 years ago

And btw. "chcp" gives me:
Aktive Codepage: 850.

Updated by naruse (Yui NARUSE) almost 11 years ago

I'm running the App (Vagrant) using Cygwin on the mintty.exe terminal.

It sounds root cause.

And btw. "chcp" gives me:
Aktive Codepage: 850.

Thanks.
Could you show following result?
ruby -e'puts Encoding.locale_charmap'

Updated by thasmo (Thomas Deinhamer) almost 11 years ago

'ruby' is not installed in my Cygwin environment, but Vagrant
has an embedded version of ruby so I ran the command using it.

cd /cygdrive/c/HashiCorp/Vagrant/embedded/bin
./ruby.exe -e'puts Encoding.locale_charmap'

Which gives the output: UTF-8

Not sure if this is the right way to test it.

With this result is it possible to
guess what the cause of the error is?

Can I do anything else to get
this fixed? Just let me know!

Updated by thasmo (Thomas Deinhamer) almost 11 years ago

So it seems to be a problem with the used shell,
not the terminal. I've now tried Console2 running
the default Windows shell and the ZSH shell from the
Cygwin environment and using the Windows shell it
works, but using ZSH/Cygwin it throws the error.

Executing this: /cygdrive/c/HashiCorp/Vagrant/embedded/bin/ruby.exe --version
gives me: ruby 1.9.3p392 (2013-02-22) [i386-mingw32]

If I comment out line 172 it works.
# msg = msg[0, len].force_encoding(Encoding.find(Encoding.locale_charmap))

I've also found some guy having similar problems (I think):
http://www.microsofttranslator.com/bv.aspx?from=&to=de&a=http%3A%2F%2Fwiki.livedoor.jp%2Fkou1okada%2Fd%2FCygwin%2520-%2520Ruby-1.9.3p327%2520-%2520win32%2Fregistry
So not sure if that's related to this encoding problem.

Actions #8

Updated by nobu (Nobuyoshi Nakada) almost 11 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r41838.
Thomas, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


win32/registry.rb: use WCHAR

  • ext/dl/win32/lib/win32/registry.rb (Error, API): use WCHAR
    interfaces. c.f. [Bug #8508]
Actions #9

Updated by thasmo (Thomas Deinhamer) over 10 years ago

Perfect. Thank you for responding, really
appreciate it! Keep up the good work! :)

Updated by thasmo (Thomas Deinhamer) over 10 years ago

Is there any roadmap where I could find
out when this fix is gonna be available
with the release of a new ruby version?

Updated by drbrain (Eric Hodel) about 10 years ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: REQUIRED, 2.0.0: REQUIRED

Add backport request

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0