mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-26 03:44:14 +02:00
2322e6fd12
Second of @scorpio810's review notes on #630: exportWiring() follows the existing CLI exporters (QTextStream, plain QFile). On Qt6 the output is UTF-8, so encoding is fine. Once #830 is in, it could optionally reuse BomExport::writeCsv() to get a BOM, which Excel needs to detect UTF-8 when opening the file directly, and an atomic write. Done directly rather than waiting on #830, since neither half depends on it and both are small. The bytes were already UTF-8; what was missing is the mark that tells Excel so. Opening a .csv without one, Excel falls back to the local 8-bit codepage and mangles any accented element label -- the common case for this project's users. QSaveFile replaces QFile so a failure part-way through leaves the previous file intact instead of a truncated one. QSaveFile is already the codebase's pattern for this (QET::writeToFile, qet.cpp:664). Verified on perceuse.qet: output now starts ef bb bf, the header follows intact, all 156 rows are preserved, and the file parses as utf-8-sig. Pointing the exporter at a missing project leaves an existing target file untouched, where before it would have been truncated. Left the other CLI exporters alone. They share the same pattern, but changing exportBom() would add a BOM to output that existing scripts already consume, which is a behaviour change outside the scope of this review note. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>