mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +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
|
||||
|
|
|
@ -56,7 +56,7 @@ css:
|
|||
.row
|
||||
.span12
|
||||
div id="editor" style="width: 100%; height: 600px; position: relative;"
|
||||
#{@file_data}
|
||||
== encoding_fix @file_data
|
||||
|
||||
|
||||
.row
|
||||
|
|
Loading…
Add table
Reference in a new issue