Skip to content

Commit

Permalink
Return registry strings of each_value and each_key as UTF-8
Browse files Browse the repository at this point in the history
Since ruby-3.0 usually all strings from the Windows-API are returned as UTF-8 strings.
Win32::Registry partly returned OEM encoding.
This was a leftover from 2.x times.
This commit changes it to UTF-8.

Fixes: oneclick/rubyinstaller2#348
  • Loading branch information
larskanis committed Oct 1, 2024
1 parent 5b66442 commit f5ea80d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/win32/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ module Win32
WCHAR_NUL = "\0".encode(WCHAR).freeze
WCHAR_CR = "\r".encode(WCHAR).freeze
WCHAR_SIZE = WCHAR_NUL.bytesize
begin
LOCALE = Encoding.find(Encoding.locale_charmap)
rescue ArgumentError
LOCALE = Encoding::UTF_8
end
LOCALE = Encoding::UTF_8

class Registry

Expand Down

0 comments on commit f5ea80d

Please sign in to comment.