diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-03-16 01:29:20 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-03-16 01:29:20 +0900 |
| commit | 8a8dbd024373dcd7d87af7d2c858221a313d8077 (patch) | |
| tree | a113b21fa12e34e6e24ca4a5cd50fb81a9c255a6 /frontend | |
| parent | 92274a2bfad642eae78060983e23100e35e588ba (diff) | |
| download | phperkaigi-2025-albatross-8a8dbd024373dcd7d87af7d2c858221a313d8077.tar.gz phperkaigi-2025-albatross-8a8dbd024373dcd7d87af7d2c858221a313d8077.tar.zst phperkaigi-2025-albatross-8a8dbd024373dcd7d87af7d2c858221a313d8077.zip | |
fix(frontend): fix code size calculation
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
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 = { |
