Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] the proper way of determining the encoding
Date: Sat, 12 Jan 2008 18:22:58 -0800	[thread overview]
Message-ID: <1200190710-sup-6881@south> (raw)
In-Reply-To: <1199925510-sup-7503@clarabella.clarabella>

Excerpts from Giorgio Lando's message of Wed Jan 09 16:39:10 -0800 2008:
> I am not a mac user, but it works fine for me!

I think I've found a better way, although it introduces yet another
dependency, to the 'gettext' gem. I'd be interested to see if this works
for you, Giorgio, and also for anyone who's running Sup under Cygwin or
OS X. This is an approach I feel a lot better about.

diff --git a/Rakefile b/Rakefile
index 2f2b992..d4060c1 100644
--- a/Rakefile
+++ b/Rakefile
@@ -17,7 +17,7 @@ Hoe.new('sup', Redwood::VERSION) do |p|
   p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[2].gsub(/^\s+/, "")
   p.changes = p.paragraphs_of('History.txt', 0..0).join("\n\n")
   p.email = "wmorgan-sup at masanjin.net"
-  p.extra_deps = [['ferret', '>= 0.10.13'], ['ncurses', '>= 0.9.1'], ['rmail', '>= 0.17'], 'highline', 'net-ssh', ['trollop', '>= 1.7'], 'lockfile', 'mime-types']
+  p.extra_deps = [['ferret', '>= 0.10.13'], ['ncurses', '>= 0.9.1'], ['rmail', '>= 0.17'], 'highline', 'net-ssh', ['trollop', '>= 1.7'], 'lockfile', 'mime-types', 'gettext']
 end
 
 rule 'ss?.png' => 'ss?-small.png' do |t|
diff --git a/lib/sup.rb b/lib/sup.rb
index 5bb27ba..064e0af 100644
--- a/lib/sup.rb
+++ b/lib/sup.rb
@@ -3,6 +3,7 @@ require 'yaml'
 require 'zlib'
 require 'thread'
 require 'fileutils'
+require 'gettext'
 require 'curses'
 
 class Object
@@ -225,9 +226,8 @@ module Redwood
   module_function :log
 end
 
-## determine encoding and character set. there MUST be a better way to
-## do this.
-  $encoding = `locale -c LC_CTYPE|head -6|tail -1`.chomp
+## determine encoding and character set
+  $encoding = Locale.current.charset
   if $encoding
     Redwood::log "using character set encoding #{$encoding.inspect}"
   else
-- 
1.5.4.rc2.60.gb2e62-dirty


-- 
William <wmorgan-sup at masanjin.net>


  reply	other threads:[~2008-01-13  2:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-05 21:46 Giorgio Lando
2008-01-07  6:04 ` William Morgan
2008-01-07  8:44   ` Giorgio Lando
2008-01-07  8:51   ` Giorgio Lando
2008-01-09 18:00     ` William Morgan
2008-01-10  0:39       ` Giorgio Lando
2008-01-13  2:22         ` William Morgan [this message]
2008-01-13 13:09           ` Giorgio Lando
2008-01-15 16:30           ` Grant Hollingworth
2008-01-16  1:45             ` William Morgan
2008-01-16  2:20               ` Nicolas Pouillard
2008-01-16  2:57                 ` William Morgan
2008-01-16  3:09                   ` William Morgan
2008-01-16  8:51                     ` Nicolas Pouillard
2008-01-16  3:14                   ` Nicolas Pouillard
2008-01-16  3:23                     ` William Morgan
2008-01-16  3:28                       ` Nicolas Pouillard
2008-01-16  3:38                         ` William Morgan
2008-01-16  8:46                           ` Nicolas Pouillard
2008-01-18 16:40                             ` Nicolas Pouillard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1200190710-sup-6881@south \
    --to=wmorgan-sup@masanjin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox