Skip to content

Commit

Permalink
Fix #74. Fix #75. Force UTF8 encoding, add </head>.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentg committed May 18, 2022
1 parent 8a5834c commit 0716234
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public HtmlReportFormatter(NamedDataIO dataIO,

@Override
public void format(ReviewReport report) throws IOException {
writer = new OutputStreamWriter(dataIO.getOutputStream());
writer = new OutputStreamWriter(dataIO.getOutputStream(),
StandardCharsets.UTF_8);
html = new Html(writer);
ClassifiedReviewReport clsReport = new ClassifiedReviewReport(report);
formatHeader();
Expand Down Expand Up @@ -205,6 +206,8 @@ private void formatHeader() throws IOException {
cssWriter.close();
html.raw(cssWriter.toString());
html.end(); // style
html.end(); // head
html.body();
}

private void formatSummary(ReviewReport report) throws IOException {
Expand Down Expand Up @@ -249,6 +252,7 @@ private void formatFooter() throws IOException {
html.p().classAttr("comments").text(String.format(
"Validation done at %s by GTFSVTOR - Copyright (c) %d Mecatran",
now, year)).end();
html.end(); // body
html.end(); // html
}

Expand Down
5 changes: 4 additions & 1 deletion src/test/resources/reports/good_feed.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@
}

</style>
</head>
<body>
<h1 class="logo image">GTFS validation report
<span class="xsmaller"> - 1
<span class="badge INFO">INFO
Expand Down Expand Up @@ -194,4 +196,5 @@ <h2>Statistics
<hr/>
<p class="comments">Validation done at 2020-01-01 by GTFSVTOR - Copyright (c) 2020 Mecatran
</p>
</head>
</body>
</html>
5 changes: 4 additions & 1 deletion src/test/resources/reports/verybad.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@
}

</style>
</head>
<body>
<h1 class="logo image">GTFS validation report
<span class="xsmaller"> - 6
<span class="badge INFO">INFO
Expand Down Expand Up @@ -10341,4 +10343,5 @@ <h2>trips.txt
<hr/>
<p class="comments">Validation done at 2020-01-01 by GTFSVTOR - Copyright (c) 2020 Mecatran
</p>
</head>
</body>
</html>

0 comments on commit 0716234

Please sign in to comment.