Fix some assertion failure

Fix function RemoveInvalidChars(const string &instr)

Signed-off-by: PlutoniumHeart <zhitaoli.hust@gmail.com>