In the latest version of OSTicket, this code is on line 238.
I modified the code as you recommended but it did not help. In my case though, the issue is not with canned responses but with incoming text/plain emails. This issue if really hitting me hard.
It would be really great if someone can suggest a code edit.
Just to recap, commenting the following line helped in fixing this issue with text/html emails.
includes / class.format.php
#$text = Format::safe_html($text, array('spec' => $spec));
But I'm unable to find the code which needs to be modified for text/plain emails.
Thanks in advance!