diff --git a/app/services/records_package.rb b/app/services/records_package.rb index 4052abb..fd87179 100644 --- a/app/services/records_package.rb +++ b/app/services/records_package.rb @@ -37,7 +37,10 @@ class RecordsPackage private + # CSVs start with a UTF-8 byte order mark so Excel reads accents, dashes + # and quotes correctly (without it, it guesses another encoding). def add(zip, name, content) + content = "\uFEFF#{content}" if name.end_with?(".csv") && !content.start_with?("\uFEFF") zip.put_next_entry(name) zip.write(content) end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index d794c52..99de1ee 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,6 +1,7 @@ + <%= render "shared/theme_script" %> <%= [content_for(:title), "Simple Aircraft Manager"].compact.join(" · ") %> diff --git a/app/views/layouts/public.html.erb b/app/views/layouts/public.html.erb index 15a1177..64cabcb 100644 --- a/app/views/layouts/public.html.erb +++ b/app/views/layouts/public.html.erb @@ -1,6 +1,7 @@ + <%= render "shared/theme_script" %> <%= [content_for(:title), "Simple Aircraft Manager"].compact.join(" · ") %> diff --git a/app/views/layouts/report.html.erb b/app/views/layouts/report.html.erb index d5b6e99..8669a4a 100644 --- a/app/views/layouts/report.html.erb +++ b/app/views/layouts/report.html.erb @@ -1,6 +1,7 @@ + <%= [content_for(:title), "Simple Aircraft Manager"].compact.join(" · ") %> diff --git a/test/integration/records_integrity_test.rb b/test/integration/records_integrity_test.rb index 9a803f6..20fc0e4 100644 --- a/test/integration/records_integrity_test.rb +++ b/test/integration/records_integrity_test.rb @@ -91,7 +91,8 @@ class RecordsIntegrityTest < ActionDispatch::IntegrationTest html = zip.text("status-report.html") assert_includes html, "Maintenance status · 14 CFR 91.417(a)(2)" refute_includes html, "" + assert_match(/\s*/, html) # files opened from disk need it (em dashes etc.) + assert_includes html, "