mirror of
https://github.com/neocities/neocities.git
synced 2025-07-22 18:46:07 +02:00
drop down to binary if UTF fails, don't conduct any replacing of characters
This commit is contained in:
parent
4d06265c9c
commit
27bcc479d5
2 changed files with 10 additions and 1 deletions
9
app.rb
9
app.rb
|
@ -579,3 +579,12 @@ end
|
|||
def template_site_title(username)
|
||||
"#{username.capitalize}#{username[username.length-1] == 's' ? "'" : "'s"} Site"
|
||||
end
|
||||
|
||||
def encoding_fix(file)
|
||||
begin
|
||||
Rack::Utils.escape_html file
|
||||
rescue ArgumentError => e
|
||||
return Rack::Utils.escape_html(file.force_encoding('BINARY')) if e.message =~ /invalid byte sequence in UTF-8/
|
||||
fail
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue