Skip to content

Non-UTF8 text files are silently undercounted #55

Description

@Phantom-VK

Problem

errors="ignore" drops every byte that fails to decode, with no signal. A Windows-1252 or UTF-16 document loses characters, so the token count comes out low and the cost estimate under-reports. Silent undercounting is a critical failure mode.

Where

  • parsing.py:56 : path.read_text(encoding="utf-8", errors="ignore")

Fix

Detect the encoding (charset-normalizer ships with requests already), or count the dropped bytes and warn when they exceed a threshold.

Severity

This affects any user analyzing a legacy document or file from Windows systems.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:parsingcore/parsing.py — PDF/PPTX/DOCX/TXT extractionbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions