"Lasse Edsvik" <la***@nospam.comwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
That's exactly the code I'm using...
As Martin has pointed out UTF-8 is not supported by FileSystemObject. Here
is one way to do it with ADODB:-
Dim oStream : oStream = Server.CreateObject("ADODB.Stream")
oStream.Open
oStream.LoadFromFile Server.MapPath("/files/temp/test.csv")
oStream.CharSet = "UTF-8"
Response.Write oStream.ReadText
What is the client going to do with this response? Load into Excel?
If there is a good reason for the CSV to be in UTF-8 encoding then the
response code page also needs to be UTF-8. That being the case it may be
better to send it as binary like this:-
<%
Response.ContentType = "text/csv"
Response.CharSet = "UTF-8"
Dim oStream : oStream = Server.CreateObject("ADODB.Stream")
oStream.Type = 1 'Binary
oStream.Open
oStream.LoadFromFile Server.MapPath("/files/temp/test.csv")
Response.BinaryWrite oStream.Read
%>
This avoids converting UTF-8 to Unicode only to have the response convert it
back to UTF-8 again.
How big is the actual file likely to be?
--
Anthony Jones - MVP ASP/ASP.NET