ICU based port of charset detection to javascript