Fix: PGN-Encoding (UTF-8/Latin-1 Fallback für Umlaute)

This commit is contained in:
2026-05-25 21:26:43 +02:00
parent b3d43e37b8
commit 352ed480a8

View File

@@ -22,7 +22,13 @@ let updateTimer = null;
async function fetchRoundPGN(round) { async function fetchRoundPGN(round) {
const res = await fetch(`https://www.deutsche-schachjugend.de/2026/odjm-d/partien/${round}.pgn?t=${Date.now()}`); const res = await fetch(`https://www.deutsche-schachjugend.de/2026/odjm-d/partien/${round}.pgn?t=${Date.now()}`);
if (!res.ok) return null; if (!res.ok) return null;
return await res.text(); const buf = await res.arrayBuffer();
// DSJ liefert ISO-8859-1; versuche UTF-8, fallback auf Latin-1
let text = new TextDecoder('utf-8').decode(buf);
if (text.includes('\uFFFD')) {
text = new TextDecoder('iso-8859-1').decode(buf);
}
return text;
} }
async function loadPGN(showOverlay = true) { async function loadPGN(showOverlay = true) {