def unicodise_safe(string, encoding=None):
 return unicodise(deunicodise(string, encoding), encoding).replace(u'\ufffd', '?')

def unicodise_safe ( string , encoding = None ) : return unicodise ( deunicodise ( string , encoding ) , encoding ) . replace ( u'\ufffd' , '?' )
convert string to unicode according to current encoding and replace all invalid characters with ? .