Forum: Ruby WIN32 registry throwing an error when searching for a key

A20b10f80c4b730d161b46a216ba0e0b?d=identicon&s=25 Ranjith Ganapuram (ranjith31)
on 2017-02-02 05:23
Hi,
We are facing an issue with the method 'export_string' in registry.rb in
the previous version of ruby(1.9.3) we haven't seen this method and now
when we are searching for a key mean while when it encountered a key
with '™ tm' then its throwing an error like ,

"C:/Ruby23/lib/ruby/2.3.0/win32/registry.rb:908:in `encode': U+2122 to
IBM437 in
conversion from UTF-16LE to UTF-8 to IBM437
(Encoding::UndefinedConversionError)"

How can we resolve this issue, can any one help me out.
Current ruby version ruby-2.3.3

Thanks,
Ranjith Ganapuram
0fa73332c8e4a3b06ea439fd3f034322?d=identicon&s=25 Ronald Fischer (rovf)
on 2017-02-06 12:40
I understand that you get an exception when this character is converted
to IBM437, but I don't understand *why* this conversion is done. It
could be a bug in Ruby 2.3, but for the safe side, can you show the
complete stack trace and in particular that part of your code, where you
invoke the respective method from the Win32::Registry class?
A20b10f80c4b730d161b46a216ba0e0b?d=identicon&s=25 Ranjith Ganapuram (ranjith31)
on 2017-02-06 14:55
In my registry there is a key it includes 'TM' symbol so it is unable to
decode at that time and I have just included the
Encoding.default_internal="UTF-8"
In my ruby script where am calling win32 registry then it's working
fine.
0fa73332c8e4a3b06ea439fd3f034322?d=identicon&s=25 Ronald Fischer (rovf)
on 2017-02-06 16:50
Did you have a different default internal encoding before? AFIK, the
internal encoding is always UTF-8, unless you specify it otherwise.
That's why I thought at first that this might have been a bug in the
Ruby library.
A20b10f80c4b730d161b46a216ba0e0b?d=identicon&s=25 Ranjith Ganapuram (ranjith31)
on 2017-02-06 18:02
No we don't have any internal encoding part and for the ruby 1.9.3 it
doesn't raise any error but this error occuring while upgrading to ruby
2.3.3 version
0fa73332c8e4a3b06ea439fd3f034322?d=identicon&s=25 Ronald Fischer (rovf)
on 2017-02-07 06:54
If this is the case, maybe it *is* a bug in Ruby, because IMO you should
not be required to do this setting, because, from my understanding,
UTF-8 is supposed to be the default. I can't test it because I don't
have a comparable Ruby system installed.

May I suggest that you open a bug report on this issue?
A20b10f80c4b730d161b46a216ba0e0b?d=identicon&s=25 Ranjith Ganapuram (ranjith31)
on 2017-02-07 17:43
Okay Ronald.
Where can I raise this bug ?
0fa73332c8e4a3b06ea439fd3f034322?d=identicon&s=25 Ronald Fischer (rovf)
on 2017-02-08 09:40
Ranjith Ganapuram wrote in post #1185538:
> Okay Ronald.
> Where can I raise this bug ?

Well, it depends on which implementation of Ruby you have! You told us
only that this is on Windows, but there are several Ruby implementations
on Windows.

But you can usually find information on where/how to open a bug report,
by either going to the website of the implementer, or by just googling
for it.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.