From 8a8dbd024373dcd7d87af7d2c858221a313d8077 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Mar 2025 01:29:20 +0900 Subject: fix(frontend): fix code size calculation --- frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'frontend') diff --git a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx index ba868ab..69da5d9 100644 --- a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx +++ b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx @@ -15,11 +15,13 @@ import SubmitStatusLabel from "../SubmitStatusLabel"; import UserIcon from "../UserIcon"; function calcCodeSize(code: string): number { - return code + const trimmed = code .replace(/\s+/g, "") .replace(/^<\?php/, "") .replace(/^<\?/, "") - .replace(/\?>$/, "").length; + .replace(/\?>$/, ""); + const utf8Encoded = new TextEncoder().encode(trimmed); + return utf8Encoded.length; } type Props = { -- cgit v1.2.3-70-g09d2