Skip to content

feat(playlist): add M3U parser with UTF-8/Cyrillic filename support#996

Open
Dipendra367 wants to merge 1 commit intoprojectM-visualizer:masterfrom
Dipendra367:fix/m3u-utf8-parser
Open

feat(playlist): add M3U parser with UTF-8/Cyrillic filename support#996
Dipendra367 wants to merge 1 commit intoprojectM-visualizer:masterfrom
Dipendra367:fix/m3u-utf8-parser

Conversation

@Dipendra367
Copy link
Copy Markdown

Fixes #962

What this does

Adds a new M3UParser class that reads .m3u and .m3u8 playlist
files into the projectM playlist library.

Why it was broken

No M3U parser existed at all — the playlist library could only scan
directories for .milk files.

How it works

  • Opens files in binary mode to preserve UTF-8 byte sequences
  • Strips Windows \r CR line endings safely
  • Skips #EXTM3U / #EXTINF metadata lines using direct '#' char
    comparison (0x23 is always single-byte in UTF-8)
  • Passes all other lines directly to Playlist::AddItem()
    Cyrillic, CJK, and any UTF-8 filename works transparently

Adds a new M3UParser class that reads .m3u and .m3u8 playlist files
and loads presets into the playlist. Handles UTF-8 encoded filenames
including Cyrillic and other non-ASCII characters correctly by:
- Opening files in binary mode to preserve UTF-8 bytes
- Stripping Windows CR line endings safely
- Using direct char comparison for '#' (0x23) instead of ctype
  functions that would misinterpret high-byte UTF-8 sequences

Fixes projectM-visualizer#962
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DEV BUG] Preset playlist parser stops when it contains random/cyrillic characters

1 participant