use string range information to optimize replace
use string range information to optimize utf8_to_string/string_to_utf8