From: DrTechDaddy Date: Mon, 16 Jan 2017 20:46:38 +0000 (-0500) Subject: midi2ly: replace unprintables with ~ X-Git-Url: https://git.donarmstrong.com/?p=lilypond.git;a=commitdiff_plain;h=1c15e46208343b4e40bc4e7bf7ef8d707f752b20 midi2ly: replace unprintables with ~ --- diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index d1fd1ab916..9c490a5f2c 100644 --- a/scripts/midi2ly.py +++ b/scripts/midi2ly.py @@ -386,10 +386,17 @@ class Text: 'PROGRAM_NAME', 'DEVICE_NAME', ) + @staticmethod + def _text_only(chr): + if ((' ' <= chr <= '~') or chr in ['\n','\r']): + return chr + else: + return '~' + def __init__ (self, type, text): self.clocks = 0 self.type = type - self.text = text + self.text =''.join(map(self._text_only, text)) def dump (self): # urg, we should be sure that we're in a lyrics staff