Python 3.15 включил UTF-8 по умолчанию: что ломается в cp1251 и как это найти до бухгалтерии
Python 3.15 makes open() read and write UTF-8 by default when no encoding is given, regardless of locale, under PEP 686. On Russian-language Windows systems and servers running ru_RU.CP1251, that means crashes on exports from 1C and, worse, silent mojibake in files passed to neighboring systems. The article reproduces the problem on 3.14 and 3.15, locates the affected spots using EncodingWarning and ruff, and fixes them so the code behaves the same across versions.
В Python 3.15 open() без encoding читает и пишет UTF-8 независимо от локали (PEP 686). На русской Windows и серверах с ru_RU.CP1251 это значит падения на выгрузках из 1С и, что хуже, тихие кракозябры в файлах для соседних систем. Воспроизводим на 3.14 и 3.15, находим такие места через EncodingWarning и ruff и чиним так, чтобы код одинаково работал на всех версиях. Читать далее