original_string: function euc_strtrunc($str, $len, $charset) {
  		$sjis = ($charset == 'shift_jis');
  		for ($i = 0; strlen($str{$i}) && $i < $len; $i++) {
  			$c = ord($str{$i});
  			if ($sjis) {
  				if (($c >= 0x80 && $c < 0xA0) || ($c >= 0xE0)) {
  					$i++;
  				} // advance a double-byte char
  			}
  			else {
  				if ($c >= 0x80) {
  					$i++;
  				} // advance a double-byte char
  			}
  		}
  		if (!strlen($str{$i})) {
  			return $str;
  		} // string shorter than supplied length
  
  		if ($i > $len) {
  			return substr($str, 0, $len - 1); // we ended on a first byte
  		} else {
  			return substr($str, 0, $len);
  		}
  	}
code: function euc_strtrunc($str, $len, $charset) {
  		$sjis = ($charset == 'shift_jis');
  		for ($i = 0; strlen($str{$i}) && $i < $len; $i++) {
  			$c = ord($str{$i});
  			if ($sjis) {
  				if (($c >= 0x80 && $c < 0xA0) || ($c >= 0xE0)) {
  					$i++;
  				} // advance a double-byte char
  			}
  			else {
  				if ($c >= 0x80) {
  					$i++;
  				} // advance a double-byte char
  			}
  		}
  		if (!strlen($str{$i})) {
  			return $str;
  		} // string shorter than supplied length
  
  		if ($i > $len) {
  			return substr($str, 0, $len - 1); // we ended on a first byte
  		} else {
  			return substr($str, 0, $len);
  		}
  	}
code_tokens: function euc_strtrunc ( $ str , $ len , $ charset ) { $ sjis = ( $ charset == 'shift_jis' ) ; for ( $ i = 0 ; strlen ( $ str { $ i } ) && $ i < $ len ; $ i ++ ) { $ c = ord ( $ str { $ i } ) ; if ( $ sjis ) { if ( ( $ c >= 0x80 && $ c < 0xA0 ) || ( $ c >= 0xE0 ) ) { $ i ++ ; } // advance a double-byte char } else { if ( $ c >= 0x80 ) { $ i ++ ; } // advance a double-byte char } } if ( ! strlen ( $ str { $ i } ) ) { return $ str ; } // string shorter than supplied length if ( $ i > $ len ) { return substr ( $ str , 0 , $ len - 1 ) ; // we ended on a first byte } else { return substr ( $ str , 0 , $ len ) ; } }
docstring: Cuts a string in the EUC charset family short at a given byte length.
  
  @param	string		EUC multibyte character string
  @param	integer		the byte length
  @param	string		the charset
  @return	string		the shortened string
  @see mb_strcut()
  @author	Martin Kutschker <martin.t.kutschker@blackbox.net>
docstring_tokens: Cuts a string in the EUC charset family short at a given byte length .