Backported improved sanitization/quoting when calling external solver from dose.