/** * Yüklenen metin dosyasını çözer: önce UTF-8 (BOM'lu ya da değil); geçersizse Excel'in * Türkçe Windows'ta varsayılan kaydettiği **Windows-1254**. (Türkçe karakterler bozulmasın.) */ export function decodeText(buf: ArrayBuffer): { text: string; encoding: 'utf-8' | 'windows-1254' } { try { return { text: new TextDecoder('utf-8', { fatal: true }).decode(buf), encoding: 'utf-8' } } catch { return { text: new TextDecoder('windows-1254').decode(buf), encoding: 'windows-1254' } } }