Added more handling rules for String.encode