remove non utf char
Fixes #607
Fixes #612
fix for resize() js bug