Encoding and XML Preservation - KevinK56/MetadataEditor GitHub Wiki

🔤 Encoding & Lossless XML Preservation

One of the biggest frustrations with generic text editors or basic NFO tools is that they either strip out unrecognized XML tags (destroying stream details, unique IDs, or custom scraper fields) or corrupt DOS ASCII art by saving CP437 files as UTF-8.

Metadata Editor is engineered from the ground up for 100% lossless XML round-tripping and accurate character encoding detection.


1. 100% Lossless XML Preservation

Media servers and metadata managers (Kodi, Emby, Jellyfin, Radarr, Sonarr, TinyMediaManager) frequently store specialized XML blocks inside .nfo files that go beyond standard fields like <title> or <plot>.

Examples include:

  • <fileinfo> and <streamdetails> (video codec h264/hevc, resolution 1920x1080, audio channels, subtitle languages)
  • <uniqueid type="tmdb" default="true">10160</uniqueid>
  • <uniqueid type="imdb">tt0097981</uniqueid>
  • <thumb aspect="poster">poster.jpg</thumb>
  • <fanart><thumb>fanart.jpg</thumb></fanart>
  • <lockdata>false</lockdata>, <dateadded>, <criticrating>, <resume>, <userstate>

How Metadata Editor Preserves Every Tag

  1. When loading an XML NFO file, Metadata Editor maps standard fields into the visual form cards (Primary Information, Story, Plot & Overview, Genres & Production Details, Cast & Characters, Online IDs & Web Links).
  2. Any other XML element—including complex nested XML blocks (<fileinfo>...</fileinfo>) and elements carrying XML attributes (<uniqueid type="tmdb" default="true">, <thumb aspect="poster">)—is automatically captured in the Custom & Extra XML Tags table at the bottom of the 📋 Metadata Form tab.
  3. You can view, edit, add (➕ Add Custom Tag), or remove (✕) these extra nodes directly in the form, or edit them in the 📝 Raw Text / XML Editor tab.
  4. When you save (Ctrl + S) or switch between the Visual Form and Raw XML tabs, every single custom tag, attribute, and nested element is serialized back into the XML cleanly without any data loss.

2. Character Encoding Detection & Conversion

.nfo files in the wild use several incompatible character encodings depending on whether they were created by modern media servers (UTF-8) or classic scene release groups (DOS CP437).

Supported Encodings

Metadata Editor inspects the Byte Order Mark (BOM) and performs heuristic byte-stream validation on every file you open:

Encoding Option Detection & Use Case
UTF-8 (Standard) Default for Kodi, Jellyfin, Emby, and modern XML scrapers (no BOM).
UTF-8 with BOM UTF-8 prefixed with 0xEF 0xBB 0xBF for legacy Windows tool compatibility.
CP437 (DOS / Scene ASCII) Original IBM PC / MS-DOS encoding used by scene release .nfo files for box-drawing (╔═╗), block shading (█▓▒░), and logos. Automatically selected when high-ASCII non-UTF-8 byte sequences are detected.
Windows-1252 (ANSI) Western European legacy Windows ANSI encoding.
UTF-16 LE (Unicode) 16-bit Little-Endian Unicode (0xFF 0xFE BOM).

Changing a File's Encoding

To convert a file from one encoding to another:

  1. Open the file in Metadata Editor.
  2. Use the Encoding: dropdown in the top toolbar to select your target encoding (e.g., UTF-8 (Standard)).
  3. Press Ctrl + S to save the file in the newly selected encoding.
⚠️ **GitHub.com Fallback** ⚠️