2011-07-21 16 views
0

私はCSVファイルを生成していますが、これらのファイルを処理している人は、ASCII形式である必要があると教えていますか?どうすればそれを作ることができますか?PHP Asciiファイルを生成しますか?

これは私がファイルを生成するために持っているもの:

$filename = '/logs/'.date('Ymd').'.txt'; 
$myfile = fopen($filename,'a'); 
fwrite($myfile, $data); 
fclose($myfile); 

このファイルには、罰金生成し、罰金...すべてが裸眼でOKですが開きますが、彼らはそれがASCII形式であることが必要であると述べました。.. 。ファイルの

出力:

"","932-4","Mike","Tanner","","1234 Testing Lane","","Los Angeles","CA","90066","","(993)857-7727","","","","SALE","","","V","4111111111111111","01/14","AXLW","","ZENC","","","REG","","511.80","","07/21/11","932-359","D1234","4","","1","","","","","","","Tanner","Mike","","1234 Testing Lane","","CA","Los Angeles","90066","","CC","","","","Y","100.00","","100.00","","","","","","","","Y","11.8","[email protected]","359","001","001","(993)857-7727","(993)857-7727","","","","","","","","","","","","","","","","","","","","222","","","","","","","","","","","","","", 

誰ですか?

おかげで...

+5

あなたは正確であることは、あなたのファイルと間違っているものを、それらを求めることができますか? – marcelog

+0

サンプル出力を投稿できますか? –

+0

出力ファイルは1行ですか? –

答えて

1

私はCarnac the Magnificentを再生するために行くとあなただけのそれぞれの行を終了するためにラインフィード(ASCII 10、別名の\ n)を使用していると言うことです。私は彼らがキャリッジリターンプラス改行(ascii 13,10)をしたいと思うでしょう。ちょうど野生の推測。 :)

+0

私は\ nと\ n \ rの両方を試しました.... –

+1

ああ、よくカルナックはそれを予測していたでしょう... –

+1

@Rick、Windowsでは\ r \ n(CRLF)です。 – foxy

1

ANSI =のWindows-1252、これはおそらく:$data = iconv("windows-1252","ASCII",$data);