<script>
document.write(substringB("我wo是shi一yi个ge好hao人ren",4,17)+"<br>");
document.write(substrB("我wo是shi一yi个ge好hao人ren",4,13));
function substringB(str,stat,end) {
  var i,ch,s = "";
  for(i=0;i<stat;i++) {
    ch = str.charAt(i);
    if(ch.charCodeAt() > 127 || ch.charCodeAt < 0)
      stat--,end--;
  }
  for(;i<end;i++) {
    ch = str.charAt(i);
    if(ch.charCodeAt() > 127 || ch.charCodeAt < 0)
      end--;
    s += ch;
  }
  return s;
}
function substrB(str,stat,len) {
  var i,ch,s = "";
  for(i=0;i<stat;i++) {
    ch = str.charAt(i);
    if(ch.charCodeAt() > 127 || ch.charCodeAt < 0)
      stat--,len--;
  }
  for(;i<len+stat+1;i++) {
    ch = str.charAt(i);
    if(ch.charCodeAt() > 127 || ch.charCodeAt < 0)
      len--;
    s += ch;
  }
  return s;
}
</script>