original_string: function euc_char_mapping($str, $charset, $mode, $opt = '') {
  		switch ($mode) {
  			case 'case':
  				if (!$this->initCaseFolding($charset)) {
  					return $str;
  				} // do nothing
  				$map =& $this->caseFolding[$charset][$opt];
  				break;
  
  			case 'ascii':
  				if (!$this->initToASCII($charset)) {
  					return $str;
  				} // do nothing
  				$map =& $this->toASCII[$charset];
  				break;
  
  			default:
  				return $str;
  		}
  
  		$sjis = ($charset == 'shift_jis');
  		$out = '';
  		for ($i = 0; strlen($str{$i}); $i++) {
  			$mbc = $str{$i};
  			$c = ord($mbc);
  
  			if ($sjis) {
  				if (($c >= 0x80 && $c < 0xA0) || ($c >= 0xE0)) { // a double-byte char
  					$mbc = substr($str, $i, 2);
  					$i++;
  				}
  			}
  			else {
  				if ($c >= 0x80) { // a double-byte char
  					$mbc = substr($str, $i, 2);
  					$i++;
  				}
  			}
  
  			if (isset($map[$mbc])) {
  				$out .= $map[$mbc];
  			} else {
  				$out .= $mbc;
  			}
  		}
  
  		return $out;
  	}
code: function euc_char_mapping($str, $charset, $mode, $opt = '') {
  		switch ($mode) {
  			case 'case':
  				if (!$this->initCaseFolding($charset)) {
  					return $str;
  				} // do nothing
  				$map =& $this->caseFolding[$charset][$opt];
  				break;
  
  			case 'ascii':
  				if (!$this->initToASCII($charset)) {
  					return $str;
  				} // do nothing
  				$map =& $this->toASCII[$charset];
  				break;
  
  			default:
  				return $str;
  		}
  
  		$sjis = ($charset == 'shift_jis');
  		$out = '';
  		for ($i = 0; strlen($str{$i}); $i++) {
  			$mbc = $str{$i};
  			$c = ord($mbc);
  
  			if ($sjis) {
  				if (($c >= 0x80 && $c < 0xA0) || ($c >= 0xE0)) { // a double-byte char
  					$mbc = substr($str, $i, 2);
  					$i++;
  				}
  			}
  			else {
  				if ($c >= 0x80) { // a double-byte char
  					$mbc = substr($str, $i, 2);
  					$i++;
  				}
  			}
  
  			if (isset($map[$mbc])) {
  				$out .= $map[$mbc];
  			} else {
  				$out .= $mbc;
  			}
  		}
  
  		return $out;
  	}
code_tokens: function euc_char_mapping ( $ str , $ charset , $ mode , $ opt = '' ) { switch ( $ mode ) { case 'case' : if ( ! $ this -> initCaseFolding ( $ charset ) ) { return $ str ; } // do nothing $ map = & $ this -> caseFolding [ $ charset ] [ $ opt ] ; break ; case 'ascii' : if ( ! $ this -> initToASCII ( $ charset ) ) { return $ str ; } // do nothing $ map = & $ this -> toASCII [ $ charset ] ; break ; default : return $ str ; } $ sjis = ( $ charset == 'shift_jis' ) ; $ out = '' ; for ( $ i = 0 ; strlen ( $ str { $ i } ) ; $ i ++ ) { $ mbc = $ str { $ i } ; $ c = ord ( $ mbc ) ; if ( $ sjis ) { if ( ( $ c >= 0x80 && $ c < 0xA0 ) || ( $ c >= 0xE0 ) ) { // a double-byte char $ mbc = substr ( $ str , $ i , 2 ) ; $ i ++ ; } } else { if ( $ c >= 0x80 ) { // a double-byte char $ mbc = substr ( $ str , $ i , 2 ) ; $ i ++ ; } } if ( isset ( $ map [ $ mbc ] ) ) { $ out .= $ map [ $ mbc ] ; } else { $ out .= $ mbc ; } } return $ out ; }
docstring: Maps all characters of a string in the EUC charset family.
  
  @param	string		EUC multibyte character string
  @param	string		the charset
  @param	string		mode: 'case' (case folding) or 'ascii' (ASCII transliteration)
  @param	string		'case': conversion 'toLower' or 'toUpper'
  @return	string		the converted string
  @author	Martin Kutschker <martin.t.kutschker@blackbox.net>
docstring_tokens: Maps all characters of a string in the EUC charset family .