mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
registry.rb: try en_US message
* ext/win32/lib/win32/registry.rb (Win32::Registry::Error#initialize): try en_US message if the default message cannot be encoded to locale. [ruby-core:65295] [Bug #10300] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4c0a560cac
commit
ba3da9af7d
2 changed files with 19 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Dec 23 16:03:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/win32/lib/win32/registry.rb (Win32::Registry::Error#initialize):
|
||||||
|
try en_US message if the default message cannot be encoded to
|
||||||
|
locale. [ruby-core:65295] [Bug #10300]
|
||||||
|
|
||||||
Tue Dec 23 11:42:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Dec 23 11:42:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/openssl/ossl_cipher.c (ossl_cipher_update_long): update huge
|
* ext/openssl/ossl_cipher.c (ossl_cipher_update_long): update huge
|
||||||
|
|
|
@ -175,11 +175,19 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
|
||||||
def initialize(code)
|
def initialize(code)
|
||||||
@code = code
|
@code = code
|
||||||
msg = WCHAR_NUL * 1024
|
msg = WCHAR_NUL * 1024
|
||||||
len = FormatMessageW.call(0x1200, 0, code, 0, msg, 1024, 0)
|
lang = 0
|
||||||
msg = msg.byteslice(0, len * WCHAR_SIZE)
|
begin
|
||||||
msg.delete!(WCHAR_CR)
|
len = FormatMessageW.call(0x1200, 0, code, lang, msg, 1024, 0)
|
||||||
msg.chomp!
|
msg = msg.byteslice(0, len * WCHAR_SIZE)
|
||||||
super msg.encode(LOCALE)
|
msg.delete!(WCHAR_CR)
|
||||||
|
msg.chomp!
|
||||||
|
msg.encode!(LOCALE)
|
||||||
|
rescue EncodingError
|
||||||
|
raise unless lang == 0
|
||||||
|
lang = 0x0409 # en_US
|
||||||
|
retry
|
||||||
|
end
|
||||||
|
super msg
|
||||||
end
|
end
|
||||||
attr_reader :code
|
attr_reader :code
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue