Closed melanchall closed 7 years ago
OK, I've added TextEncoding
property to ReadingSettings
and WritingSettings
. These changes will be available in the next release of the DryWetMIDI.
To write the text of text-based meta events, for example, in Unicode you will be able to specify desired encoding via WritingSettings
:
midiFile.Write("output.mid",
settings: new WritingSettings { TextEncoding = Encoding.Unicode });
and then you can read this file using the same encoding via ReadingSettings
:
var midiFile = MidiFile.Read("input.mid",
settings: new ReadingSettings { TextEncoding = Encoding.Unicode });
DryWetMIDI 1.2.0 has been released. This release contains a fix for this bug as described in the post above.
Max, Thanks for this. For the text fields (that are represented as 8-bit ASCII, not Unicode), the value "TextEncoding = Encoding.GetEncoding(28591)" works for me in this specific case (28591 is ISO 8859-1, aka Latin-1). Kind regards, Nico
Nico,
Sounds good, glad to hear that you've solved your problem :)
Max
From discussion in #1:
@nicowitteman
Hi Max, I switched to framework, and I think the library is very useful. Now I have this issue: In a MIDI file bwv227.zip there is a track named "Ténor". In SequenceTrackNameEvent.Text it is represented as "T?nor". That is a pity, because I want to write the tracks away as files with their trackname. This one fails. Any suggestions? Nico
@melanchall
Hi Nico,
It is because the
Text
of any text-based meta event is processed in ASCII encoding. Obviously theé
symbol doesn't belong this encoding. I'm planning to add other encodings support later. Maybe as a first iteration I will introduce kind ofTextEncoding
property inReadingSettings
/WritingSettings
so you will be able to specify desired encoding for strings serialization/deserialization. Yes, sounds like a plan.Thank you for your feedback and for remebering me about non-ASCII encodings in text-based meta events. I'll try to provide a solution in the next release which should be at the beginning of August.
Max
@nicowitteman
Thanks Max, I will await the update. Nico