Sweep all .cshtml files for encoding corruption; add pre-commit guard

Replace all corruption variants with HTML entities across 226 view files:
- 3-char UTF-8-as-Win1252 sequences (ae-corruption)
- Standalone smart/curly quotes that break C# Razor expressions
- Partially re-corrupted variants where the 3rd byte was normalised to ASCII

tools/Fix-Encoding.ps1: re-runnable sweep; uses [char] code points so the
script itself never contains a literal non-ASCII character; supports -DryRun

.githooks/pre-commit: blocks commits containing the ae-corruption byte
signature (xc3xa2xe2x82xac); git core.hooksPath = .githooks so the
hook is repo-committed and active for all future work on this machine.

Build clean; 225 unit tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-20 21:37:10 -04:00
parent 21b39161a3
commit a0bdd2b5b4
252 changed files with 1785 additions and 1633 deletions
@@ -29,7 +29,7 @@
<!-- Header -->
<div class="d-flex align-items-center gap-2 mb-3 no-print">
<a asp-action="Index" class="btn btn-sm btn-outline-secondary"><i class="bi bi-arrow-left"></i></a>
<p class="text-muted mb-0">Income Statement @Model.From.ToString("MMM d") @Model.To.ToString("MMM d, yyyy")</p>
<p class="text-muted mb-0">Income Statement &mdash; @Model.From.ToString("MMM d") &ndash; @Model.To.ToString("MMM d, yyyy")</p>
@if (Model.AccountingMethod == PowderCoating.Core.Enums.AccountingMethod.Cash)
{
<span class="badge bg-warning text-dark">Cash Basis</span>
@@ -80,7 +80,7 @@
<div class="text-center mb-4 d-none d-print-block">
<h4 class="fw-bold">@Model.CompanyName</h4>
<h5>Profit &amp; Loss</h5>
<p class="text-muted">@Model.From.ToString("MMMM d, yyyy") @Model.To.ToString("MMMM d, yyyy")</p>
<p class="text-muted">@Model.From.ToString("MMMM d, yyyy") &ndash; @Model.To.ToString("MMMM d, yyyy")</p>
</div>
<!-- KPI Summary -->
@@ -123,7 +123,7 @@
<div class="card shadow-sm">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="fw-semibold"><i class="bi bi-file-earmark-bar-graph me-1"></i>Income Statement</span>
<span class="text-muted small">@Model.From.ToString("MMM d") @Model.To.ToString("MMM d, yyyy")</span>
<span class="text-muted small">@Model.From.ToString("MMM d") &ndash; @Model.To.ToString("MMM d, yyyy")</span>
</div>
<div class="table-responsive">
<table class="table table-sm align-middle mb-0">
@@ -148,7 +148,7 @@
<tr>
<td class="ps-4">@line.AccountNumber <span class="text-muted">@line.AccountName</span></td>
<td class="text-end">@line.Amount.ToString("C")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "" : (line.Amount / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "&mdash;" : (line.Amount / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
</tr>
}
<tr class="report-subtotal-row">
@@ -169,18 +169,18 @@
<tr>
<td class="ps-4">@line.AccountNumber <span class="text-muted">@line.AccountName</span></td>
<td class="text-end">@line.Amount.ToString("C")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "" : (line.Amount / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "&mdash;" : (line.Amount / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
</tr>
}
<tr class="report-subtotal-row">
<td class="ps-4 fw-semibold">Total COGS</td>
<td class="text-end fw-semibold text-warning">(@Model.TotalCogs.ToString("C"))</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "" : (Model.TotalCogs / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "&mdash;" : (Model.TotalCogs / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
</tr>
<tr class="report-subtotal-row">
<td class="ps-2 fw-semibold">Gross Profit</td>
<td class="text-end fw-semibold @(Model.GrossProfit >= 0 ? "text-success" : "text-danger")">@Model.GrossProfit.ToString("C")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "" : Model.GrossMarginPercent.ToString("F1") + "%")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "&mdash;" : Model.GrossMarginPercent.ToString("F1") + "%")</td>
</tr>
}
@@ -198,20 +198,20 @@
<tr>
<td class="ps-4">@line.AccountNumber <span class="text-muted">@line.AccountName</span></td>
<td class="text-end">@line.Amount.ToString("C")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "" : (line.Amount / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "&mdash;" : (line.Amount / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
</tr>
}
<tr class="report-subtotal-row">
<td class="ps-4 fw-semibold">Total Expenses</td>
<td class="text-end fw-semibold text-danger">(@Model.TotalExpenses.ToString("C"))</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "" : (Model.TotalExpenses / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "&mdash;" : (Model.TotalExpenses / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
</tr>
</tbody>
<tfoot>
<tr class="report-net-row @(Model.NetIncome < 0 ? "report-net-negative" : "")">
<td class="ps-2">Net Income</td>
<td class="text-end @(Model.NetIncome >= 0 ? "text-success" : "text-danger")">@Model.NetIncome.ToString("C")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "" : (Model.NetIncome / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
<td class="text-end text-muted small">@(Model.TotalRevenue == 0 ? "&mdash;" : (Model.NetIncome / Model.TotalRevenue * 100).ToString("F1") + "%")</td>
</tr>
</tfoot>
</table>