px-files/_sys/php/processors/encodingconverter.php
public function apply($src){

		if( is_array( $this->ext ) ){
			// 対象の拡張子か調べる (pickles2/px-fw-2.x v2.0.40 で追加されたオプション)
			$ext = $this->px->get_path_proc_type( $this->px->req()->get_request_file_path() );
			$ext = strtolower($ext);
			$is_target = false;
			foreach($this->ext as $target_ext){
				if($ext == strtolower($target_ext)){
					$is_target = true;
					break;
				}
			}
			if(!$is_target){
				return $src;
			}
		}

		if( strlen( $this->output_encoding ) ){
			$output_encoding = $this->output_encoding;
			if( !strlen($output_encoding) ){ $output_encoding = 'UTF-8'; }

			//出力ソースの文字コード変換(HTML)
			$src = preg_replace('/\@charset\s+"[a-zA-Z0-9\_\-\.]+"\;/si','@charset "'.htmlspecialchars($output_encoding).'";',$src);
			$src = preg_replace('/\@charset\s+\'[a-zA-Z0-9\_\-\.]+\'\;/si','@charset \''.htmlspecialchars($output_encoding).'\';',$src);
			$src = preg_replace('/(<meta\s+charset\=")[a-zA-Z0-9\_\-\.]+("\s*\/?'.'>)/si','$1'.htmlspecialchars($output_encoding).'$2',$src);
			$src = preg_replace('/(<meta\s+http\-equiv\="Content-Type"\s+content\="[a-zA-Z0-9\_\-\+]+\/[a-zA-Z0-9\_\-\+]+\;\s*charset\=)[a-zA-Z0-9\_\-\.]+("\s*\/?'.'>)/si','$1'.htmlspecialchars($output_encoding).'$2',$src);
			$src = $this->px->convert_encoding( $src, $output_encoding );
		}

		if( strlen( $this->output_eol_coding ) ){
			//出力ソースの改行コード変換
			$eol_code = "\r\n";
			switch( strtolower( $this->output_eol_coding ) ){
				case 'cr':     $eol_code = "\r"; break;
				case 'lf':     $eol_code = "\n"; break;
				case 'crlf':
				default:       $eol_code = "\r\n"; break;
			}
			$src = preg_replace('/\r\n|\r|\n/si', $eol_code, $src);
		}

		return $src;
	}
public function apply($src){

		if( is_array( $this->ext ) ){
			// 対象の拡張子か調べる (pickles2/px-fw-2.x v2.0.40 で追加されたオプション)
			$ext = $this->px->get_path_proc_type( $this->px->req()->get_request_file_path() );
			$ext = strtolower($ext);
			$is_target = false;
			foreach($this->ext as $target_ext){
				if($ext == strtolower($target_ext)){
					$is_target = true;
					break;
				}
			}
			if(!$is_target){
				return $src;
			}
		}

		if( strlen( $this->output_encoding ) ){
			$output_encoding = $this->output_encoding;
			if( !strlen($output_encoding) ){ $output_encoding = 'UTF-8'; }

			//出力ソースの文字コード変換(HTML)
			$src = preg_replace('/\@charset\s+"[a-zA-Z0-9\_\-\.]+"\;/si','@charset "'.htmlspecialchars($output_encoding).'";',$src);
			$src = preg_replace('/\@charset\s+\'[a-zA-Z0-9\_\-\.]+\'\;/si','@charset \''.htmlspecialchars($output_encoding).'\';',$src);
			$src = preg_replace('/(<meta\s+charset\=")[a-zA-Z0-9\_\-\.]+("\s*\/?'.'>)/si','$1'.htmlspecialchars($output_encoding).'$2',$src);
			$src = preg_replace('/(<meta\s+http\-equiv\="Content-Type"\s+content\="[a-zA-Z0-9\_\-\+]+\/[a-zA-Z0-9\_\-\+]+\;\s*charset\=)[a-zA-Z0-9\_\-\.]+("\s*\/?'.'>)/si','$1'.htmlspecialchars($output_encoding).'$2',$src);
			$src = $this->px->convert_encoding( $src, $output_encoding );
		}

		if( strlen( $this->output_eol_coding ) ){
			//出力ソースの改行コード変換
			$eol_code = "\r\n";
			switch( strtolower( $this->output_eol_coding ) ){
				case 'cr':     $eol_code = "\r"; break;
				case 'lf':     $eol_code = "\n"; break;
				case 'crlf':
				default:       $eol_code = "\r\n"; break;
			}
			$src = preg_replace('/\r\n|\r|\n/si', $eol_code, $src);
		}

		return $src;
	}
apply output filter
@param string $src HTML, CSS, JavaScriptなどの出力コード
@return string 加工後の出力コード