|
<%
'***********************************************************
' キャラクタセット変更
'***********************************************************
' ------------------------------------------------------
' 入力用 Stream オブジェクト の作成
' ------------------------------------------------------
Set Stream = Server.CreateObject("ADODB.Stream")
' ------------------------------------------------------
' 入力用 Stream のオープン
' ------------------------------------------------------
Stream.Open
' ------------------------------------------------------
' Stream タイプをテキストとして指定
' ------------------------------------------------------
Stream.Type = 2 ' StreamTypeEnum の adTypeText
' ------------------------------------------------------
' 入力ソースのキャラクタセットを指定
' ------------------------------------------------------
Stream.Charset = "shift_jis"
' ------------------------------------------------------
' 既存ファイルの内容を入力 Stream に読み込む
' ------------------------------------------------------
Stream.LoadFromFile Server.MapPath( "sample.htm" )
' ------------------------------------------------------
' 出力用 Stream オブジェクト の作成
' ------------------------------------------------------
Set Stream2 = Server.CreateObject("ADODB.Stream")
' ------------------------------------------------------
' 出力用 Stream のオープン
' ------------------------------------------------------
Stream2.Open
' ------------------------------------------------------
' 出力ファイルのキャラクタセットを指定
' ------------------------------------------------------
Stream2.Charset = "euc-jp"
' ------------------------------------------------------
' Stream オブジェクトのコピー
' ------------------------------------------------------
Stream.CopyTo Stream2
' ------------------------------------------------------
' ファイルへ上書き出力
' ------------------------------------------------------
Stream2.SaveToFile Server.MapPath( "sample.htm" ), 2
' ------------------------------------------------------
' Stream を閉じる
' ------------------------------------------------------
Stream2.Close
Stream.Close
' ------------------------------------------------------
' Stream オブジェクト の解放
' ------------------------------------------------------
Set Stream2 = Nothing
Set Stream = Nothing
%>
| |