Unicode and filestream

A

ASP

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
 
M

Mark Schupp

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top