Skip to content

PeanutTheAdmin/utf8-add-bom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

UTF-8 to UTF-8 with BOM Converter

This simple Python script allows users to convert UTF-8 text files into UTF-8 with BOM so that Windows Notepad (especially on Windows 11) correctly recognizes the encoding.

Many .txt files created or saved as UTF-8 without a BOM may be misinterpreted by Notepad as UTF-16 or another encoding, causing display issues. This tool fixes that automatically with a user-friendly GUI.


Features

  • Opens a file picker to select your UTF-8 .txt file.
  • Converts the file to UTF-8 with BOM.
  • Saves the output in the same folder with _utf8_bom appended to the filename.
  • No command-line knowledge required — click and convert!

Requirements

  • Python 3.x
  • No additional libraries needed (uses built-in tkinter and os modules).
    • tkinter comes pre-installed with standard Python distributions.

Usage

  1. Download the script utf8_add_bom.py.
  2. Double-click the script to launch the GUI.
  3. Select a UTF-8 .txt file.
  4. The script creates a new file with _utf8_bom appended to the name in the same folder.
  5. Open the new file in Notepad — it should now be correctly recognized as UTF-8.

Example:

Original file:

example.txt

Converted file:

example_utf8_bom.txt

Converting the Script to an Executable (Optional)

If you do not want to use the prebuilt .exe provided in the GitHub release, you can create your own using PyInstaller:

  1. Install PyInstaller:
pip install pyinstaller
  1. Navigate to the folder containing utf8_add_bom.py and run:
pyinstaller --onefile --windowed utf8_add_bom.py
  1. After it finishes, you will find the standalone executable in the dist folder:
dist\utf8_add_bom.exe
  1. You can now run this .exe directly — no Python installation is required.

Optional flags:

  • Add a custom icon:
pyinstaller --onefile --windowed --icon=myicon.ico utf8_add_bom.py
  • Change the output folder:
pyinstaller --onefile --windowed --distpath ./output utf8_add_bom.py

Notes

  • This script does not modify the original file.
  • The output file is fully compatible with Windows Notepad, preventing mojibake caused by encoding misdetection.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages