Results 1 to 3 of 3

Thread: FSO writting symbol to text file

  1. #1

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    FSO writting symbol to text file

    Hi,

    I'm having a bit of trouble writting the copyright symbol to a text file here is a cut down version of my page

    Strangely when I write "©" to file the "©" gets written, but the "Â" is ignored????

    Code:
    <%@ Language="vbscript" codepage=65001 %>
    <%
    Option Explicit
    Response.Buffer=True
    %>
    <!DocType html Public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    	<title></title>
    	<meta http-equiv="content-type" content="text/html;charset=utf-8">
    </head>
    <body>
    <%
    Call WriteToFile("First: ""©""" & vbNewLine,"c:\temp\","testdata.txt",True)
    Call WriteToFile("Second: ""©""" & vbNewLine,"c:\temp\","testdata.txt",False)
    %>
    </body>
    </html>
    
    <%
    Sub WriteToFile(sWhat, sPath, sFName, bOverwrite)
    	Dim oFile 			' File Object
    	Dim oOut 			' File Out Stream
    	Const ForReading=1
    	Const ForWriting=2
    	Const ForAppending=8
    	
    	Set oFile = Server.CreateObject("Scripting.FileSystemObject")
    	
    	Set oOut = oFile.OpenTextFile(sPath & sFName, IIf(bOverwrite,ForWriting,ForAppending), True)
    
    	oOut.Write(sWhat)
    	oOut.Close
    
    	Set oOut = Nothing
    	Set oFile = Nothing
    End Sub
    
    Function IIf(expr,var1,var2)
    	If expr Then IIf=var1 Else IIf=var2
    End Function
    %>
    Any help will greatly appreciated

    Cheers Al

  2. #2
    Hyperactive Member gtilles's Avatar
    Join Date
    Dec 2004
    Location
    Planet Earth
    Posts
    394

    Re: FSO writting symbol to text file

    Try replacing with chr(169) for your copyright

    Not sure what the other symbol is.
    Here is a link to a code converter
    http://www.lookuptables.com/
    Where you see Numeric rows place that value in chr(?) to get that symbol.
    You only need the number not &#
    Truly, you have a dizzying intellect.

  3. #3

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: FSO writting symbol to text file

    gtilles,

    Thanks for your reply, chr(169) produces "t". I'm pretty sure that this is being caused by the -


    Code:
    <%@ Language="vbscript" codepage=65001 %>
    <%
    Option Explicit
    Response.Buffer=True
    %>
    <!DocType html Public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    	<title></title>
    	<meta http-equiv="content-type" content="text/html;charset=utf-8">
    </head>
    <body>
    Just not sure how to get around it. Have searched google without success for "utf-8 copyright symbol chr"

    [Edit] - Hmmm maybe not. I've removed them to no effect. When I write to a file from a vb app the symbols output correctly

    Cheers Al
    Last edited by aconybeare; Mar 15th, 2007 at 05:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width