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
@@ -131,7 +131,7 @@
<form method="get" class="row g-2 align-items-end">
<div class="col-md-4">
<input name="search" value="@ViewBag.Search" class="form-control form-control-sm"
placeholder="Company name, email, Stripe ID" />
placeholder="Company name, email, Stripe ID&hellip;" />
</div>
<div class="col-md-2">
<select name="status" class="form-select form-select-sm">
@@ -208,12 +208,12 @@
@c.SubscriptionEndDate.Value.Tz(ViewBag.CompanyTimeZone as string).ToString("MM/dd/yyyy")
</span>
}
else { <span class="text-muted"></span> }
else { <span class="text-muted">&mdash;</span> }
</td>
<td>
@if (!string.IsNullOrEmpty(c.StripeCustomerId))
{ <code class="small">@c.StripeCustomerId</code> }
else { <span class="text-muted"></span> }
else { <span class="text-muted">&mdash;</span> }
</td>
<td onclick="event.stopPropagation()">
<a asp-action="Manage" asp-route-id="@c.Id"
@@ -227,7 +227,7 @@
</table>
</div>
<!-- Mobile card view shown on screens < 992px (table-responsive hidden by mobile-cards.css) -->
<!-- Mobile card view &mdash; shown on screens < 992px (table-responsive hidden by mobile-cards.css) -->
<div class="mobile-card-view">
<div class="mobile-card-list">
@if (!Model.Any())
@@ -263,7 +263,7 @@
}
else
{
<span class="text-muted"></span>
<span class="text-muted">&mdash;</span>
}
</span>
</div>
@@ -284,7 +284,7 @@
{
<div class="card-footer d-flex align-items-center justify-content-between py-2">
<small class="text-muted">
Showing @((page - 1) * pageSize + 1)@Math.Min(page * pageSize, totalCount) of @totalCount.ToString("N0")
Showing @((page - 1) * pageSize + 1)&ndash;@Math.Min(page * pageSize, totalCount) of @totalCount.ToString("N0")
</small>
<nav>
<ul class="pagination pagination-sm mb-0">
@@ -317,7 +317,7 @@
@Html.AntiForgeryToken()
<script>
(function () {
// ── Plan feature toggles ──────────────────────────────────────────
// -- Plan feature toggles ------------------------------------------
document.querySelectorAll('.plan-feature-toggle').forEach(function (toggle) {
toggle.addEventListener('change', async function () {
const planId = this.dataset.planId, feature = this.dataset.feature;
@@ -337,7 +337,7 @@
});
});
// ── Bulk selection ────────────────────────────────────────────────
// -- Bulk selection ------------------------------------------------
const toolbar = document.getElementById('bulk-toolbar');
const countEl = document.getElementById('selected-count');
const selectAll = document.getElementById('select-all');
@@ -2,7 +2,7 @@
@using PowderCoating.Core.Enums
@model Company
@{
ViewData["Title"] = $"Manage {Model.CompanyName}";
ViewData["Title"] = $"Manage &ndash; {Model.CompanyName}";
var planConfigs = (dynamic)ViewBag.PlanConfigs;
string PlanName(int plan)
@@ -66,9 +66,9 @@
<dt class="col-7 text-muted">Users</dt>
<dd class="col-5 fw-semibold">@ViewBag.UserCount</dd>
<dt class="col-7 text-muted">Stripe Customer</dt>
<dd class="col-5"><code class="small">@(Model.StripeCustomerId ?? "")</code></dd>
<dd class="col-5"><code class="small">@(Model.StripeCustomerId ?? "&mdash;")</code></dd>
<dt class="col-7 text-muted">Stripe Sub</dt>
<dd class="col-5"><code class="small">@(Model.StripeSubscriptionId ?? "")</code></dd>
<dd class="col-5"><code class="small">@(Model.StripeSubscriptionId ?? "&mdash;")</code></dd>
</dl>
</div>
</div>
@@ -99,7 +99,7 @@
<form method="post" asp-action="UpdateSubscription" asp-route-id="@Model.Id">
@Html.AntiForgeryToken()
@* Comped / Internal card prominent *@
@* Comped / Internal card &mdash; prominent *@
<div class="card border-0 shadow-sm mb-3 @(Model.IsComped ? "border-success border-2" : "")">
<div class="card-header border-0 py-3 @(Model.IsComped ? "bg-success bg-opacity-10" : "bg-white")">
<h6 class="mb-0 fw-semibold">
@@ -351,11 +351,11 @@
</div>
<dl class="row small mb-3">
<dt class="col-5 text-muted">Invoice</dt>
<dd class="col-7 font-monospace" id="refund-invoice-number"></dd>
<dd class="col-7 font-monospace" id="refund-invoice-number">&mdash;</dd>
<dt class="col-5 text-muted">Amount Paid</dt>
<dd class="col-7 fw-semibold" id="refund-amount-paid"></dd>
<dd class="col-7 fw-semibold" id="refund-amount-paid">&mdash;</dd>
<dt class="col-5 text-muted">Max Refundable</dt>
<dd class="col-7 fw-semibold text-success" id="refund-max-amount"></dd>
<dd class="col-7 fw-semibold text-success" id="refund-max-amount">&mdash;</dd>
</dl>
<div class="mb-3">
<label class="form-label fw-medium">Refund Amount</label>
@@ -402,7 +402,7 @@
@section Scripts {
<script>
// ── State for the refund modal ────────────────────────────────────────────────
// -- State for the refund modal ------------------------------------------------
let _refundPaymentIntentId = null;
let _refundMaxCents = 0;
let _refundAmountPaid = '';
@@ -442,7 +442,7 @@ async function loadPaymentHistory() {
: '';
const refundedCell = ch.amountRefunded
? `<span class="text-danger small">${ch.amountRefunded}</span>`
: '<span class="text-muted small"></span>';
: '<span class="text-muted small">&mdash;</span>';
const desc = ch.description ? `<span class="text-muted">${ch.description}</span>` : `<code class="small">${ch.id}</code>`;
// Show Refund button only for succeeded charges that still have something refundable
@@ -469,7 +469,7 @@ async function loadPaymentHistory() {
}
function openRefundModal(chargeId, refundableCents, amountPaid, displayLabel) {
_refundPaymentIntentId = chargeId; // reusing variable now holds charge ID
_refundPaymentIntentId = chargeId; // reusing variable &mdash; now holds charge ID
_refundMaxCents = refundableCents;
_refundAmountPaid = amountPaid;
_refundInvoiceNumber = displayLabel;
@@ -509,7 +509,7 @@ async function submitRefund() {
}
submitBtn.disabled = true;
submitBtn.innerHTML = '<span class="spinner-border spinner-border-sm me-1"></span>Processing';
submitBtn.innerHTML = '<span class="spinner-border spinner-border-sm me-1"></span>Processing&hellip;';
try {
const formData = new FormData();