M
Mark Anderson
Hi, I've a problem with code that should produce a Windows(ANSI) encoded
text file but doesn't. Server is IIS 5 on Win 2k, with ASP ver?
My ASP uses data from an upstream HTML form on a UTF-8 encoded page. The
latter is output by a server-side system and I can't alter that source
format.
Here's some of the ASP code (may wrap):
' Following vars are longer strings but of this type - just more Request
object vlaues added
strLabels = "Filename" & vbTab "EXTENDED_DESCRIPTION"
strValues = Request.Form("Filename") & vbTab &
Request.Form("EXTENDED_DESCRIPTION")
On Error Resume Next
' set up the FSO
Set fso = CreateObject("Scripting.FileSystemObject")
' Create the lock file ('ture' arg allows file overwrite if already
exists)
Set objMyFile = fso.CreateTextFile(strDataFile, True)
If Err.Number = 0 Then
' Successfuly created file, let's write to it
objMyFile.WriteLine(strLabels)
objMyFile.WriteLine(strValues)
' close - we're done
objMyFile.Close
This code worked with the previous version of the server-side system but
since it was upgraded now the next part after the ASP form-to-file
process breaks as expects a Windows(ANSI) TXT file. When I do a text
import of my current ASP created files it reports "MS_DOS(PC-8)". I
assume the move to UTF-* encoded pages upstream is the issue.
I assume the ASP is getting UTF-8 values from the Response object. How
can I parse these to ANSI encoding to get a valid Windows(ANSI) Text
file?
Many thanks.
Mark
text file but doesn't. Server is IIS 5 on Win 2k, with ASP ver?
My ASP uses data from an upstream HTML form on a UTF-8 encoded page. The
latter is output by a server-side system and I can't alter that source
format.
Here's some of the ASP code (may wrap):
' Following vars are longer strings but of this type - just more Request
object vlaues added
strLabels = "Filename" & vbTab "EXTENDED_DESCRIPTION"
strValues = Request.Form("Filename") & vbTab &
Request.Form("EXTENDED_DESCRIPTION")
On Error Resume Next
' set up the FSO
Set fso = CreateObject("Scripting.FileSystemObject")
' Create the lock file ('ture' arg allows file overwrite if already
exists)
Set objMyFile = fso.CreateTextFile(strDataFile, True)
If Err.Number = 0 Then
' Successfuly created file, let's write to it
objMyFile.WriteLine(strLabels)
objMyFile.WriteLine(strValues)
' close - we're done
objMyFile.Close
This code worked with the previous version of the server-side system but
since it was upgraded now the next part after the ASP form-to-file
process breaks as expects a Windows(ANSI) TXT file. When I do a text
import of my current ASP created files it reports "MS_DOS(PC-8)". I
assume the move to UTF-* encoded pages upstream is the issue.
I assume the ASP is getting UTF-8 values from the Response object. How
can I parse these to ANSI encoding to get a valid Windows(ANSI) Text
file?
Many thanks.
Mark