electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.7k stars 1.74k forks source link

The build process will change the encoding of the license.rtf file. #8512

Closed TianbinTobin closed 1 month ago

TianbinTobin commented 2 months ago

The original encoding of my license.rtf file is UTF-8, but after the build process, the encoding has changed to UTF-8 with BOM. This behavior will cause the License display on the installation interface to appear as garbled text. (My language is Chinese.) image

mmaietta commented 1 month ago

@TianbinTobin what OS are you packaging your Windows app on?

@beyondkmp looks like this may be related to the changes in https://github.com/electron-userland/electron-builder/pull/8314. Wondering if we need to have conditional logic when building on windows vs mac w.r.t file encoding

TianbinTobin commented 1 month ago

what OS are you packaging your Windows app on?

@mmaietta Windows 11

beyondkmp commented 1 month ago

@mmaietta In https://github.com/electron-userland/electron-builder/issues/8294, I have only fixed the issue of garbled text display on Windows.

The problem describing seems to be a different issue on Windows. @TianbinTobin Could you provide a minimal demo to reproduce the problem?

TianbinTobin commented 1 month ago

Could you provide a minimal demo to reproduce the problem?

https://github.com/TianbinTobin/electron-builder-8512.git

The first build will change the encoding of the rtf file, and the second build of the installation package will appear garbled on windows. @beyondkmp

beyondkmp commented 1 month ago

@TianbinTobin I have a question: Why not write Chinese directly in this file? If Chinese is written directly, there wouldn't be any issues even with multiple compilations.

image
beyondkmp commented 1 month ago

Root Cause: If the file is already in UTF-8 BOM format, there's no need to convert it again. If it's converted again, it will result in garbled characters.