summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--ext/win32/lib/win32/registry.rb12
2 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a3e21e91ad..149870a1af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Sep 24 16:39:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#each_value): encode
+ name.
+
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#each_key): ditto.
+
+ * ext/win32/lib/win32/registry.rb (Win32::Registry#export_string):
+ encode to locale encoding if default internal is not set.
+
Tue Sep 24 16:35:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/win32/lib/win32/registry.rb (Win32::Registry::API#EnumKey):
diff --git a/ext/win32/lib/win32/registry.rb b/ext/win32/lib/win32/registry.rb
index d989bc0e7e..668f573edb 100644
--- a/ext/win32/lib/win32/registry.rb
+++ b/ext/win32/lib/win32/registry.rb
@@ -290,7 +290,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
name = WCHAR_NUL * Constants::MAX_KEY_LENGTH
size = packdw(Constants::MAX_KEY_LENGTH)
check RegEnumValueW.call(hkey, index, name, size, 0, 0, 0, 0)
- name[0, unpackdw(size)].encode
+ name[0, unpackdw(size)]
end
def EnumKey(hkey, index)
@@ -298,7 +298,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
size = packdw(Constants::MAX_KEY_LENGTH)
wtime = ' ' * 8
check RegEnumKeyExW.call(hkey, index, name, size, 0, 0, 0, wtime)
- [ name[0, unpackdw(size)].encode, unpackqw(wtime) ]
+ [ name[0, unpackdw(size)], unpackqw(wtime) ]
end
def QueryValue(hkey, name)
@@ -558,6 +558,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
rescue Error
break
end
+ subkey = export_string(subkey)
begin
type, data = read(subkey)
rescue Error
@@ -594,6 +595,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
rescue Error
break
end
+ subkey = export_string(subkey)
yield subkey, wtime
index += 1
end
@@ -883,5 +885,11 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
end
__END__
end
+
+ private
+
+ def export_string(str, enc = Encoding.default_internal || LOCALE) # :nodoc:
+ str.encode(enc)
+ end
end
end