RustAudio / rimd

Library for handling Midi and Standard Midi Files in Rust
MIT License
80 stars 17 forks source link

Don't assume Latin-1 encoding for meta events #11

Open xTibor opened 6 years ago

xTibor commented 6 years ago

As per the standard. It only specifies the text encoding of the meta events should be compatible with 7-bit ASCII and leaves the the rest of the character space open for anything:

The text in this event should be printable ASCII characters for maximum interchange. However, other character codes using the high-order bit may be used for interchange of files between different programs on the same computer which supports an extended character set. Programs on a computer which does not support non-ASCII characters should ignore those characters.

This means any ASCII-compatible encoding could be used, not just Latin-1. For example here's a dump of a Japanese Shift-JIS encoded MIDI file I found on my disk, garbled by rimd: https://gist.github.com/xTibor/e32594e372c81d416f699a126cc066ce

It would be great if this was configurable in rimd.