diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-01-17 19:35:48 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-01-17 19:35:48 +0000 |
commit | 41d544631dcb6748ea792f1d8019b5e301056d18 (patch) | |
tree | 9598e6a50f06223e55a32583984375fed87541bb | |
parent | 9d735b9f19f53e8aab18a04c5524ff8d051fb397 (diff) |
Force the 'C' locale for elinks
The behaviour of elinks is locale-dependent. This patch forces LANG=C
which makes the behaviour consistent across platforms.
-rw-r--r-- | app/models/incoming_message.rb | 4 | ||||
-rw-r--r-- | lib/alaveteli_external_command.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 8e48d75d2..91f1cf7c0 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -943,8 +943,8 @@ class IncomingMessage < ActiveRecord::Base # lynx wordwraps links in its output, which then don't # get formatted properly by Alaveteli. We use elinks # instead, which doesn't do that. - AlaveteliExternalCommand.run("elinks", "-eval", "'set document.codepage.assume = \"#{charset}\"'", "-eval", "'set document.codepage.force_assumed = 1'", "-dump-charset", "utf-8", "-force-html", "-dump", - tempfile.path, :append_to => text) + AlaveteliExternalCommand.run("elinks", "-eval", "set document.codepage.assume = \"#{charset}\"", "-eval", "set document.codepage.force_assumed = 1", "-dump-charset", "utf-8", "-force-html", "-dump", + tempfile.path, :append_to => text, :env => {"LANG" => "C"}) elsif content_type == 'application/vnd.ms-excel' # Bit crazy using /usr/bin/strings - but xls2csv, xlhtml and # py_xls2txt only extract text from cells, not from floating diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb index 737b48fa9..b1d4f17d1 100644 --- a/lib/alaveteli_external_command.rb +++ b/lib/alaveteli_external_command.rb @@ -30,7 +30,7 @@ module AlaveteliExternalCommand if opts.has_key? :append_to xc.out = opts[:append_to] end - xc.run(opts[:stdin_string]) + xc.run(opts[:stdin_string], opts[:env] || {}) if xc.status != 0 # Error $stderr.puts("Error from #{program_name} #{args.join(' ')}:") |