Reverted code to encode special character. Made it work for unicode chars.