function conv($str, $fromCS, $toCS, $useEntityForNoChar = 0) {
		if ($fromCS == $toCS) {
			return $str;
		}

			// PHP-libs don't support fallback to SGML entities, but UTF-8 handles everything
		if ($toCS == 'utf-8' || !$useEntityForNoChar) {
			switch ($GLOBALS['TYPO3_CONF_VARS']['SYS']['t3lib_cs_convMethod']) {
				case 'mbstring':
					$conv_str = mb_convert_encoding($str, $toCS, $fromCS);
					if (FALSE !== $conv_str) {
						return $conv_str;
					} // returns FALSE for unsupported charsets
					break;

				case 'iconv':
					$conv_str = iconv($fromCS, $toCS . '//TRANSLIT', $str);
					if (FALSE !== $conv_str) {
						return $conv_str;
					}
					break;

				case 'recode':
					$conv_str = recode_string($fromCS . '..' . $toCS, $str);
					if (FALSE !== $conv_str) {
						return $conv_str;
					}
					break;
			}
			// fallback to TYPO3 conversion
		}

		if ($fromCS != 'utf-8') {
			$str = $this->utf8_encode($str, $fromCS);
		}
		if ($toCS != 'utf-8') {
			$str = $this->utf8_decode($str, $toCS, $useEntityForNoChar);
		}
		return $str;
	}
function conv($str, $fromCS, $toCS, $useEntityForNoChar = 0) {
		if ($fromCS == $toCS) {
			return $str;
		}

			// PHP-libs don't support fallback to SGML entities, but UTF-8 handles everything
		if ($toCS == 'utf-8' || !$useEntityForNoChar) {
			switch ($GLOBALS['TYPO3_CONF_VARS']['SYS']['t3lib_cs_convMethod']) {
				case 'mbstring':
					$conv_str = mb_convert_encoding($str, $toCS, $fromCS);
					if (FALSE !== $conv_str) {
						return $conv_str;
					} // returns FALSE for unsupported charsets
					break;

				case 'iconv':
					$conv_str = iconv($fromCS, $toCS . '//TRANSLIT', $str);
					if (FALSE !== $conv_str) {
						return $conv_str;
					}
					break;

				case 'recode':
					$conv_str = recode_string($fromCS . '..' . $toCS, $str);
					if (FALSE !== $conv_str) {
						return $conv_str;
					}
					break;
			}
			// fallback to TYPO3 conversion
		}

		if ($fromCS != 'utf-8') {
			$str = $this->utf8_encode($str, $fromCS);
		}
		if ($toCS != 'utf-8') {
			$str = $this->utf8_decode($str, $toCS, $useEntityForNoChar);
		}
		return $str;
	}
function conv ( $ str , $ fromCS , $ toCS , $ useEntityForNoChar = 0 ) { if ( $ fromCS == $ toCS ) { return $ str ; } // PHP-libs don't support fallback to SGML entities, but UTF-8 handles everything if ( $ toCS == 'utf-8' || ! $ useEntityForNoChar ) { switch ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'SYS' ] [ 't3lib_cs_convMethod' ] ) { case 'mbstring' : $ conv_str = mb_convert_encoding ( $ str , $ toCS , $ fromCS ) ; if ( FALSE !== $ conv_str ) { return $ conv_str ; } // returns FALSE for unsupported charsets break ; case 'iconv' : $ conv_str = iconv ( $ fromCS , $ toCS . '//TRANSLIT' , $ str ) ; if ( FALSE !== $ conv_str ) { return $ conv_str ; } break ; case 'recode' : $ conv_str = recode_string ( $ fromCS . '..' . $ toCS , $ str ) ; if ( FALSE !== $ conv_str ) { return $ conv_str ; } break ; } // fallback to TYPO3 conversion } if ( $ fromCS != 'utf-8' ) { $ str = $ this -> utf8_encode ( $ str , $ fromCS ) ; } if ( $ toCS != 'utf-8' ) { $ str = $ this -> utf8_decode ( $ str , $ toCS , $ useEntityForNoChar ) ; } return $ str ; }
Convert from one charset to another charset.

@param	string		Input string
@param	string		From charset (the current charset of the string)
@param	string		To charset (the output charset wanted)
@param	boolean		If set, then characters that are not available in the destination character set will be encoded as numeric entities
@return	string		Converted string
@see convArray()
Convert from one charset to another charset .