From 5470a49651af8c90a5ced885caff76ebf30b08dd Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 12 Nov 2021 21:17:20 -0800 Subject: [PATCH] Use utf8 in API error messages I noticed this when Playwright was trying to draw cute ASCII art and it wasn't showing up right! Not a big deal, but it's a bit more correct to do this, so let's do it! --- pages/api/allWakaValues.js | 2 +- pages/api/assetImage.js | 2 +- pages/api/outfitImage.js | 2 +- pages/api/outfitPageSSR.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/api/allWakaValues.js b/pages/api/allWakaValues.js index 1b4dcc6..677d61a 100644 --- a/pages/api/allWakaValues.js +++ b/pages/api/allWakaValues.js @@ -20,7 +20,7 @@ async function handle(req, res) { itemValuesByIdOrName = await loadWakaValuesByIdOrName(); } catch (e) { console.error(e); - res.setHeader("Content-Type", "text/plain"); + res.setHeader("Content-Type", "text/plain; charset=utf8"); res.status(500).send("Error loading Waka data from Google Sheets API"); return; } diff --git a/pages/api/assetImage.js b/pages/api/assetImage.js index ab05e94..1a13c08 100644 --- a/pages/api/assetImage.js +++ b/pages/api/assetImage.js @@ -173,7 +173,7 @@ function isNeopetsUrl(urlString) { } function reject(res, message, status = 400) { - res.setHeader("Content-Type", "text/plain"); + res.setHeader("Content-Type", "text/plain; charset=utf8"); return res.status(status).send(message); } diff --git a/pages/api/outfitImage.js b/pages/api/outfitImage.js index 4904757..5e67f00 100644 --- a/pages/api/outfitImage.js +++ b/pages/api/outfitImage.js @@ -225,7 +225,7 @@ async function loadUpdatedAtForSavedOutfit(outfitId) { } function reject(res, message, status = 400) { - res.setHeader("Content-Type", "text/plain"); + res.setHeader("Content-Type", "text/plain; charset=utf8"); return res.status(status).send(message); } diff --git a/pages/api/outfitPageSSR.js b/pages/api/outfitPageSSR.js index d34bd74..712c2f7 100644 --- a/pages/api/outfitPageSSR.js +++ b/pages/api/outfitPageSSR.js @@ -132,7 +132,7 @@ async function loadIndexPageHtml() { } function reject(res, message, status = 400) { - res.setHeader("Content-Type", "text/plain"); + res.setHeader("Content-Type", "text/plain; charset=utf8"); return res.status(status).send(message); }