Skip to content

Commit

Permalink
Merge pull request #2053 from zz9pzza/issue_4242_v2
Browse files Browse the repository at this point in the history
issue 4242: Another way to remove the warning
  • Loading branch information
CristinaRO committed Mar 8, 2015
2 parents 8c1970c + 1c9be8a commit a73bce3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
3 changes: 0 additions & 3 deletions Gemfile
Expand Up @@ -20,9 +20,6 @@ gem 'redis-namespace'

# Here are all our application-specific gems

# Move to the iconv gem...
gem 'iconv'

# Lograge is opinionated, very opinionated.
gem "lograge" # https://github.com/roidrage/lograge

Expand Down
2 changes: 0 additions & 2 deletions Gemfile.lock
Expand Up @@ -140,7 +140,6 @@ GEM
json (~> 1.8)
multi_xml (>= 0.5.2)
i18n (0.7.0)
iconv (1.0.4)
journey (1.0.4)
jquery-rails (3.0.1)
railties (>= 3.0, < 5.0)
Expand Down Expand Up @@ -398,7 +397,6 @@ DEPENDENCIES
google_visualr (>= 2.1)
htmlentities
httparty
iconv
jquery-rails (>= 0.2.6)
kgio
launchy
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/downloads_controller.rb
Expand Up @@ -156,7 +156,7 @@ def create_mobi_html
def render_mobi_html(template, basename)
@mobi = true
html = render_to_string(:template => "downloads/#{template}.html", :layout => 'barebones.html')
html = ::Iconv.conv("ASCII//TRANSLIT//IGNORE", "UTF8", html)
html = html.encode('ascii', :undef => :replace, :replace => '')
File.open("#{@work.download_dir}/mobi/#{basename}.html", 'w') {|f| f.write(html)}
end

Expand Down
6 changes: 3 additions & 3 deletions app/models/work.rb
Expand Up @@ -737,7 +737,7 @@ def download_folder

def download_fandoms
string = self.fandoms.size > 3 ? ts("Multifandom") : self.fandoms.string
string = ::Iconv.conv("ASCII//TRANSLIT//IGNORE", "UTF8", string)
string = string.encode('ascii', :undef => :replace, :replace => '')
string.gsub(/[^[\w _-]]+/, '')
end
def display_authors
Expand All @@ -746,12 +746,12 @@ def display_authors
# need the next two to be filesystem safe and not overly long
def download_authors
string = self.anonymous? ? ts("Anonymous") : self.pseuds.sort.map(&:name).join('-')
string = ::Iconv.conv("ASCII//TRANSLIT//IGNORE", "UTF8", string)
string = string.encode('ascii', :undef => :replace, :replace => '')
string = string.gsub(/[^[\w _-]]+/, '')
string.gsub(/^(.{24}[\w.]*).*/) {$1}
end
def download_title
string = ::Iconv.conv("ASCII//TRANSLIT//IGNORE", "UTF8", self.title)
string = self.title.encode('ascii', :undef => :replace, :replace => '')
string = string.gsub(/[^[\w _-]]+/, '')
string = "Work by " + download_authors if string.blank?
string.gsub(/ +/, " ").strip.gsub(/^(.{24}[\w.]*).*/) {$1}
Expand Down

0 comments on commit a73bce3

Please sign in to comment.