vineld
12-14-2007, 05:58 PM
I am having trouble creating and writing to a text file in ASP (classic) on an IIS server. I need the text file to be UTF-8 but it will not happen..., any ideas?
![]() | View Full Version : ASP and UTF-8 vineld 12-14-2007, 05:58 PM I am having trouble creating and writing to a text file in ASP (classic) on an IIS server. I need the text file to be UTF-8 but it will not happen..., any ideas? holmesa 12-14-2007, 06:39 PM What exactly is the problem? You cannot read it with asp code later. or you cannot read it in some type of text editor? mwaseem 12-15-2007, 02:07 AM When i was working with my AJAX, the XML files needed to be created with UTF-8 encoding... so, bellow is the code to create a blank file with above character set... Private Sub CreateUTF8File(FilePath, DummyData) Dim objStream Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Position = 0 objStream.Charset = "UTF-8" objStream.WriteText DummyData objStream.SaveToFile FilePath objStream.Close Set objStream = Nothing End Sub vineld 12-15-2007, 04:59 AM Thanks a lot, I will try that. Earlier on I used this: set fso = createobject("scripting.filesystemobject") Set act = fso.CreateTextFile(Server.MapPath(file_being_created), true, true) act.WriteLine("<?xml version=""1.0"" encoding=""utf-8""?>") And, well, it spits out the text file correctly although it is never a UTF-8 file which I also need. |