original_string: function euc_char2byte_pos($str, $pos, $charset) {
  		$sjis = ($charset == 'shift_jis');
  		$n = 0; // number of characters seen
  		$p = abs($pos); // number of characters wanted
  
  		if ($pos >= 0) {
  			$i = 0;
  			$d = 1;
  		} else {
  			$i = strlen($str) - 1;
  			$d = -1;
  		}
  
  		for (; strlen($str{$i}) && $n < $p; $i += $d) {
  			$c = ord($str{$i});
  			if ($sjis) {
  				if (($c >= 0x80 && $c < 0xA0) || ($c >= 0xE0)) {
  					$i += $d;
  				} // advance a double-byte char
  			}
  			else {
  				if ($c >= 0x80) {
  					$i += $d;
  				} // advance a double-byte char
  			}
  
  			$n++;
  		}
  		if (!strlen($str{$i})) {
  			return FALSE;
  		} // offset beyond string length
  
  		if ($pos < 0) {
  			$i++;
  		} // correct offset
  
  		return $i;
  	}
code: function euc_char2byte_pos($str, $pos, $charset) {
  		$sjis = ($charset == 'shift_jis');
  		$n = 0; // number of characters seen
  		$p = abs($pos); // number of characters wanted
  
  		if ($pos >= 0) {
  			$i = 0;
  			$d = 1;
  		} else {
  			$i = strlen($str) - 1;
  			$d = -1;
  		}
  
  		for (; strlen($str{$i}) && $n < $p; $i += $d) {
  			$c = ord($str{$i});
  			if ($sjis) {
  				if (($c >= 0x80 && $c < 0xA0) || ($c >= 0xE0)) {
  					$i += $d;
  				} // advance a double-byte char
  			}
  			else {
  				if ($c >= 0x80) {
  					$i += $d;
  				} // advance a double-byte char
  			}
  
  			$n++;
  		}
  		if (!strlen($str{$i})) {
  			return FALSE;
  		} // offset beyond string length
  
  		if ($pos < 0) {
  			$i++;
  		} // correct offset
  
  		return $i;
  	}
code_tokens: function euc_char2byte_pos ( $ str , $ pos , $ charset ) { $ sjis = ( $ charset == 'shift_jis' ) ; $ n = 0 ; // number of characters seen $ p = abs ( $ pos ) ; // number of characters wanted if ( $ pos >= 0 ) { $ i = 0 ; $ d = 1 ; } else { $ i = strlen ( $ str ) - 1 ; $ d = - 1 ; } for ( ; strlen ( $ str { $ i } ) && $ n < $ p ; $ i += $ d ) { $ c = ord ( $ str { $ i } ) ; if ( $ sjis ) { if ( ( $ c >= 0x80 && $ c < 0xA0 ) || ( $ c >= 0xE0 ) ) { $ i += $ d ; } // advance a double-byte char } else { if ( $ c >= 0x80 ) { $ i += $ d ; } // advance a double-byte char } $ n ++ ; } if ( ! strlen ( $ str { $ i } ) ) { return FALSE ; } // offset beyond string length if ( $ pos < 0 ) { $ i ++ ; } // correct offset return $ i ; }
docstring: Translates a character position into an 'absolute' byte position.
  
  @param	string		EUC multibyte character string
  @param	integer		character position (negative values start from the end)
  @param	string		the charset
  @return	integer		byte position
  @author	Martin Kutschker <martin.t.kutschker@blackbox.net>
docstring_tokens: Translates a character position into an absolute byte position .