Skip to content

Commit

Permalink
Fix issue with encoding defaulting to latin1 instead of a more proper…
Browse files Browse the repository at this point in the history
… UTF8. Also hard set exe path to where easy_install defaults to.
  • Loading branch information
jsjohnst committed Mar 1, 2009
1 parent 171206d commit 6ad3e04
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/jekyll/albino.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
require 'open4'

class Albino
@@bin = Rails.development? ? 'pygmentize' : '/usr/bin/pygmentize' rescue 'pygmentize'
@@bin = '/usr/local/bin/pygmentize'

def self.bin=(path)
@@bin = path
Expand All @@ -54,17 +54,23 @@ def self.colorize(*args)
new(*args).colorize
end

def initialize(target, lexer = :text, format = :html)
def initialize(target, lexer = :text, format = :html, encoding = "encoding=utf8")
@target = File.exists?(target) ? File.read(target) : target rescue target
@options = { :l => lexer, :f => format }
@options = { :l => lexer, :f => format, :P => encoding }
end

def execute(command)
output = ''
Open4.popen4(command) do |pid, stdin, stdout, stderr|
stdin.puts @target
stdin.close

output = stdout.read.strip

# puts "pid : #{ pid }"
# puts "stdout : #{ stdout.read.strip }"
# puts "stderr : #{ stderr.read.strip }"

end

# rdiscount wants the closing pre on a line by itself
Expand Down

0 comments on commit 6ad3e04

Please sign in to comment.