Changed replace input to handle wide chars