Unicode and filestream

Discussion in 'ASP General' started by ASP, Jun 15, 2005.

  1. ASP

    ASP Guest

    Why this code doesn't work ? The "testUnicode.asp" file is in Unicode UTF-8
    and use the Normalization Form C with the Byte Order Mark (BOM, or Unicode
    Signature).

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>

    <body>
    <%
    Const ForReading = 1, TristateTrue = -1

    Dim fso
    Set fso = Server.CreateObject("Scripting.FileSystemObject")

    Dim objTextStream
    Set objTextStream = fso_OpenTextFile(Server.MapPath("testUnicode.asp"),
    ForReading, False, TristateTrue) ' -1 = Open file for reading in unicode

    Response.Write(objTextStream.ReadAll)

    objTextStream.Close
    Set objTextStream = Nothing

    Set fso = Nothing
    %>
    </body>

    </html>

    Thanks a lot !!!!

    J.-Luc
     
    ASP, Jun 15, 2005
    #1
    1. Advertising

  2. ASP

    Mark Schupp Guest

    What does "doesn't work" mean (what are the symptoms)?

    I don't think you use a BOM for UTF-8 as it maps unicode into 1-3 bytes not
    into 2.

    --
    --Mark Schupp


    "ASP" <> wrote in message
    news:%23sU$...
    > Why this code doesn't work ? The "testUnicode.asp" file is in Unicode
    > UTF-8
    > and use the Normalization Form C with the Byte Order Mark (BOM, or Unicode
    > Signature).
    >
    > <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    > "http://www.w3.org/TR/html4/loose.dtd">
    > <html>
    >
    > <head>
    > <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    > </head>
    >
    > <body>
    > <%
    > Const ForReading = 1, TristateTrue = -1
    >
    > Dim fso
    > Set fso = Server.CreateObject("Scripting.FileSystemObject")
    >
    > Dim objTextStream
    > Set objTextStream = fso_OpenTextFile(Server.MapPath("testUnicode.asp"),
    > ForReading, False, TristateTrue) ' -1 = Open file for reading in unicode
    >
    > Response.Write(objTextStream.ReadAll)
    >
    > objTextStream.Close
    > Set objTextStream = Nothing
    >
    > Set fso = Nothing
    > %>
    > </body>
    >
    > </html>
    >
    > Thanks a lot !!!!
    >
    > J.-Luc
    >
    >
     
    Mark Schupp, Jun 15, 2005
    #2
    1. Advertising

  3. ASP

    ASP Guest

    You can see the result of this code at
    http://dpel.unilat.org/tests/testUnicode.asp

    Any idea ?

    J.-Luc

    PS.
    I use Dreamweaver to create the file testUnicode.asp.


    __________________
    "Mark Schupp" <> a écrit dans le message de
    news:...
    > What does "doesn't work" mean (what are the symptoms)?
    >
    > I don't think you use a BOM for UTF-8 as it maps unicode into 1-3 bytes

    not
    > into 2.
    >
    > --
    > --Mark Schupp
    >
    >
    > "ASP" <> wrote in message
    > news:%23sU$...
    > > Why this code doesn't work ? The "testUnicode.asp" file is in Unicode
    > > UTF-8
    > > and use the Normalization Form C with the Byte Order Mark (BOM, or

    Unicode
    > > Signature).
    > >
    > > <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    > > "http://www.w3.org/TR/html4/loose.dtd">
    > > <html>
    > >
    > > <head>
    > > <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    > > </head>
    > >
    > > <body>
    > > <%
    > > Const ForReading = 1, TristateTrue = -1
    > >
    > > Dim fso
    > > Set fso = Server.CreateObject("Scripting.FileSystemObject")
    > >
    > > Dim objTextStream
    > > Set objTextStream =

    fso_OpenTextFile(Server.MapPath("testUnicode.asp"),
    > > ForReading, False, TristateTrue) ' -1 = Open file for reading in

    unicode
    > >
    > > Response.Write(objTextStream.ReadAll)
    > >
    > > objTextStream.Close
    > > Set objTextStream = Nothing
    > >
    > > Set fso = Nothing
    > > %>
    > > </body>
    > >
    > > </html>
    > >
    > > Thanks a lot !!!!
    > >
    > > J.-Luc
    > >
    > >

    >
    >
     
    ASP, Jun 15, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amit
    Replies:
    8
    Views:
    3,818
    Alan Pretre
    Aug 4, 2003
  2. majiofpersia

    webservices filestream

    majiofpersia, Jul 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    325
    majiofpersia
    Jul 16, 2003
  3. Dorsa
    Replies:
    11
    Views:
    798
    vMike
    Jan 2, 2004
  4. Hawksey
    Replies:
    3
    Views:
    984
    Mark Rae
    Nov 30, 2006
  5. Ben
    Replies:
    7
    Views:
    2,549
Loading...

Share This Page