Skip to content

vgm: convert metadata strings from UCS-2 to UTF-8#145

Open
drfiemost wants to merge 2 commits intolibgme:masterfrom
drfiemost:vgm_utf8
Open

vgm: convert metadata strings from UCS-2 to UTF-8#145
drfiemost wants to merge 2 commits intolibgme:masterfrom
drfiemost:vgm_utf8

Conversation

@drfiemost
Copy link
Copy Markdown
Contributor

@drfiemost drfiemost commented Aug 31, 2025

In VGM files the metadata strings are encoded as UCS-2.
Currently only the low byte is considered and if the high byte is not zero the character is simply replaced by a question mark, causing loss of information.

This patch converts the strings from UCS-2 to UTF-8 preserving the metadata.
The downside is that other formats provide the track info in ANSI or ASCII, thus causing an inconsistent interface.

One possible solution is to add a flag to the track_info_t struct that specifies if metadata is in UTF-8 or ANSI format.
Otherwise the applications could rely on the file extension but that would be quite ugly.

@drfiemost drfiemost force-pushed the vgm_utf8 branch 2 times, most recently from e05239b to dc7ea6f Compare September 2, 2025 18:48
@drfiemost
Copy link
Copy Markdown
Contributor Author

One possible solution is to add a flag to the track_info_t struct that specifies if metadata is in UTF-8 or ANSI format.

Updated to use one of the reserved vars from gme_info_t for this, preserving backward compatibility

@drfiemost drfiemost marked this pull request as ready for review September 2, 2025 18:58
for vgm we convert from UCS-2 to UTF-8, for SAP data is a subset of ASCII so UTF-8 compatible, NSFe should use UTF-8, all the others are some unspecified ANSI codepage
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.

1 participant