Fix #1270 by replacing insignificant characters before comparing