Browse Source

piuparts_tap: explicitely set Encoding::UTF_8 for Ruby 1.9

On Debian/wheezy LANG and LC_ALL are empty by default (and therefore
defaulting to 'C' locale), running piuparts_tap therefore fails with:

| /usr/bin/piuparts_tap:26:in `gsub': invalid byte sequence in US-ASCII (ArgumentError)
| 	from /usr/bin/piuparts_tap:26:in `<main>'

The real fix would be to set LANG/LC_ALL accordingly, but we can't
control this from inside the piuparts_tap script, so let's
work around this issue by setting Encoding::UTF_8 explicitely.

Thanks: Christian Hofstaedtler <ch@zeha.at> for feedback
merge-requests/109/head
Michael Prokop 9 years ago
parent
commit
bd6d573a3b
  1. 5
      tap/piuparts_tap

5
tap/piuparts_tap

@ -1,5 +1,10 @@
#!/usr/bin/env ruby
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
if ARGV[0].nil?
$stderr.puts "Usage: #{File.basename $0} <piuparts_logfile>"
exit 1

Loading…
Cancel
Save