473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Unicode and filestream

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
Jul 22 '05 #1
2 4496
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" <in***@almageste.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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

Jul 22 '05 #2
ASP
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" <no******@email.net> a écrit dans le message de
news:uB**************@TK2MSFTNGP15.phx.gbl...
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" <in***@almageste.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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


Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Viorel | last post by:
About FileStream and StreamWriter!? I have a string1 which contains(of course in unicode) a html code with Unicode charset specified in it. 1) bytecontent=...
4
by: Majed | last post by:
Hi , all I'm trying to write unicode to a file for another app (not developed with vs2003) to read it. I used StreamWriter with unicode encoding.but I was surprised that the streamwriter adds FFFE...
3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
1
by: Linda Chen | last post by:
I need to write some unicode symbols such as degree symbol (for example 36°) by using XMLTextWrite but couldn't make it work. I found the degree char in unicode is '\u030A' and here is my sample...
4
by: Nick | last post by:
Hi, I am trying to output a string of chinese characters as a text file. When I open a file for writing from VB, the file is automatically set to UTF-8 encoding (can tell by opening the file...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
1
by: Scott Duckworth | last post by:
Can anyone provide a quick code snippit to open a text file and tell if it's ASCII or Unicode? Thanks
0
by: UvT | last post by:
Can anyone tell me how to create a text file with Unicode Encoding. In am using FileStream Finalfile = new FileStream("finalfile.txt", FileMode.Append, FileAccess.Write); Now this creates...
1
by: ujjwaltrivedi | last post by:
Hey guys, Can anyone tell me how to create a text file with Unicode Encoding. In am using FileStream Finalfile = new FileStream("finalfile.txt", FileMode.Append, FileAccess.Write); ...
2
by: JimmyKoolPantz | last post by:
We purchased som software for encoding a barcode. We want to automate the process of converting a number to a readable barcode. However, I am having a few issues. The file that the barcode...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.