[DRE-commits] [SCM] ruby-locale.git branch, master, updated. debian/2.0.5-5-2-g4a20cfc
Hleb Valoshka
375GNU at Gmail.COM
Fri Jul 13 21:09:18 UTC 2012
The following commit has been merged in the master branch:
commit 3cf78fd4a570c238711d8b55a4bd416761faddb9
Author: Hleb Valoshka <375GNU at Gmail.COM>
Date: Sat Jul 14 00:05:49 2012 +0300
add patch 0004-fix-bugs-with-charset-handling
diff --git a/debian/patches/0004-fix-bugs-with-charset-handling.patch b/debian/patches/0004-fix-bugs-with-charset-handling.patch
new file mode 100644
index 0000000..d41f362
--- /dev/null
+++ b/debian/patches/0004-fix-bugs-with-charset-handling.patch
@@ -0,0 +1,88 @@
+From: Hleb Valoshka <375GNU at Gmail.COM>
+Date: Sat, 14 Jul 2012 00:00:47 +0300
+Subject: fix bugs with charset handling
+
+Fixes #520181, #521169
+---
+ lib/locale.rb | 6 +++---
+ lib/locale/driver/env.rb | 4 ++--
+ lib/locale/tag/posix.rb | 5 +++--
+ lib/locale/tag/simple.rb | 2 +-
+ 4 files changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/lib/locale.rb b/lib/locale.rb
+index 10bc71e..e4f44bf 100644
+--- a/lib/locale.rb
++++ b/lib/locale.rb
+@@ -94,7 +94,7 @@ module Locale
+ @@locale_driver_module
+ end
+
+- DEFAULT_LANGUAGE_TAG = Locale::Tag::Simple.new("en") #:nodoc:
++ DEFAULT_LANGUAGE_TAG = Locale::Tag::Simple.new("C") #:nodoc:
+
+ # Sets the default locale as the language tag
+ # (Locale::Tag's class or String(such as "ja_JP")).
+@@ -196,8 +196,8 @@ module Locale
+ # Returns the language tags which are variations of the current locales order by priority.
+ #
+ # For example, if the current locales are ["fr", "ja_JP", "en_US", "en-Latn-GB-VARIANT"],
+- # then returns ["fr", "ja_JP", "en_US", "en-Latn-GB-VARIANT", "en_Latn_GB", "en_GB", "ja", "en"].
+- # "en" is the default locale(You can change it using set_default).
++ # then returns ["fr", "ja_JP", "en_US", "en-Latn-GB-VARIANT", "en_Latn_GB", "en_GB", "ja", "C"].
++ # "C" is the default locale(You can change it using set_default).
+ # The default locale is added at the end of the list even if it isn't exist.
+ #
+ # Usually, this method is used to find the locale data as the path(or a kind of IDs).
+diff --git a/lib/locale/driver/env.rb b/lib/locale/driver/env.rb
+index 3d08500..78df8c5 100644
+--- a/lib/locale/driver/env.rb
++++ b/lib/locale/driver/env.rb
+@@ -24,11 +24,11 @@ module Locale
+ module Env
+ module_function
+
+- # Gets the locale from environment variable. (LC_ALL > LC_MESSAGES > LANG)
++ # Gets the locale from environment variable. (LC_ALL > LC_CTYPE > LANG)
+ # Returns: the locale as Locale::Tag::Posix.
+ def locale
+ # At least one environment valiables should be set on *nix system.
+- [ENV["LC_ALL"], ENV["LC_MESSAGES"], ENV["LANG"]].each do |loc|
++ [ENV["LC_ALL"], ENV["LC_CTYPE"], ENV["LANG"]].each do |loc|
+ if loc != nil and loc.size > 0
+ return Locale::Tag::Posix.parse(loc)
+ end
+diff --git a/lib/locale/tag/posix.rb b/lib/locale/tag/posix.rb
+index b04aa54..c23dd0a 100644
+--- a/lib/locale/tag/posix.rb
++++ b/lib/locale/tag/posix.rb
+@@ -26,13 +26,14 @@ module Locale
+
+ def initialize(language, region = nil, charset = nil, modifier = nil)
+ @charset, @modifier = charset, modifier
++ @charset ||= `locale charmap`.chomp rescue nil
+ super(language, region)
+ end
+
+ def self.parse(tag)
+ if tag =~ /^(C|POSIX)$/
+- ret = self.new("en", "US")
+- ret.tag = tag
++ ret = self.new("C")
++ ret.tag = "C"
+ ret
+ elsif tag =~ TAG_RE
+ ret = self.new($1, $2, $3, $4)
+diff --git a/lib/locale/tag/simple.rb b/lib/locale/tag/simple.rb
+index bf3719b..d52268e 100644
+--- a/lib/locale/tag/simple.rb
++++ b/lib/locale/tag/simple.rb
+@@ -75,7 +75,7 @@ module Locale
+ def initialize(language, region = nil)
+ raise "language can't be nil." unless language
+ @language, @region = language, region
+- @language = @language.downcase if @language
++ @language = @language.downcase unless @language == 'C'
+ @region = @region.upcase if @region
+ end
+
diff --git a/debian/patches/series b/debian/patches/series
index c3b11c1..343da39 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
0001-fix-failure-caused-by-empty-env-variable-language.patch
0002-fix-better-check-of-current-locale-setter-input.patch
0003-fix-untainted-path-under-safe-1.patch
+0004-fix-bugs-with-charset-handling.patch
--
ruby-locale.git
More information about the Pkg-ruby-extras-commits
mailing list