473,498 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems writing percent character

I have written an asp funciton to write a 301 redirect. It gets the file
name and the new desitination as arguments. I am doing this for hundreds of
files so a script is more accurate than doing it manually and much faster, I
thought. Problem is it chokes on the line:

FileText = FileText & "%>" & vbcrlf

Error message is:
Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/NewTest/TestRedirects/WriteRedirects.asp, line 58

FileText = FileText & "
-----------------------^It doesn't have any problem with FileText = FileText
& "<%" & vbcrlf

I've tried escaping it:

FileText = FileText & "\%>" & vbcrlf

but it chokes on the "\"

How can I append "%>" to a string????

Full function follows:

function CreateRedirect(Filename,Destination)
FullFilename = server.mappath(Filename)
set fs = CreateObject("Scripting.FileSystemObject")
set file = fs.OpenTextFile(FullFilename, 2, true)
FileText = ""
FileText = FileText & "<%" & vbcrlf
FileText = FileText & "Response.Status = ""301 Moved Permanently""" &
vbcrlf
FileText = FileText & "Response.addheader ""Location"",""" & Destination
& """ & vbcrlf
FileText = FileText & "Response.End" & vbcrlf
FileText = FileText & "%>" & vbcrlf
file.WriteLine(FileText)
file.Close()
set fs = nothing
end function
Jul 22 '05 #1
5 1861

Try with
What is the content of FileText ?

FileText = FileText & Chr(37) & ">" & vbcrlf
Jul 22 '05 #2

"Gérard Leclercq" <ge*************@pas-de-mail.fr> wrote in message
news:9M********************@phobos.telenet-ops.be...

Try with
What is the content of FileText ?

FileText = FileText & Chr(37) & ">" & vbcrlf

Thanks! That solved it.
Jul 22 '05 #3
Gérard Leclercq wrote on 16 feb 2005 in
microsoft.public.inetserver.asp.general:
Try with
What is the content of FileText ?

FileText = FileText & Chr(37) & ">" & vbcrlf

FileText = FileText & "%" & ">" & vbcrlf

Why can I never remember them ascii numbers?
'cause they are American?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #4
Evertjan. wrote:
Why can I never remember them ascii numbers?
'cause they are American?


This American uses Arabic numerals for expressing ASCII numbers.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #5
"Dave Anderson" wrote in message
news:uU**************@TK2MSFTNGP09.phx.gbl...
: Evertjan. wrote:
: > Why can I never remember them ascii numbers?
: > 'cause they are American?
:
: This American uses Arabic numerals for expressing ASCII numbers.

I'm using Italian (Roman) numerals with a lemon twist for expressing ASCII
numbers in my champagne cocktail. (O:=

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Jul 22 '05 #6

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

Similar topics

12
9795
by: jdonnell | last post by:
I have a mysql database with characters like   » in it. I'm trying to write a python script to remove these, but I'm having a really hard time. These strings are coming out as type 'str'...
1
3228
by: Craig Hurcum | last post by:
Hi, I'm trying to log a formatted event to the Windows NT Security Event Log but I am having problems. I can get events into the log, but always unformatted with the data appearing in the...
2
4169
by: Scott Vercuski | last post by:
Everyone, I'm having trouble writing an event to the event log. Here is the chunk of code I currently have. ----------------------------------------------------------------------- Private...
2
3806
by: Colby | last post by:
Using the following code I am trying to write to a text file. I keep getting "£" All I want is "£" Any Ideas? using System;
0
843
by: Stefano Giannone | last post by:
Hi, I've problem with some character input by the user into a web form. The requestEncoding and responseEncoding are set to "iso-8859-1", but some character truncate the request (I see this...
7
4533
by: Jon Maz | last post by:
Hi, I'm having problems with a RewriteRule that's applied to url's with the % character in them, hope someone can help. The % character is a result of url-encoding non-ASCII words, as in the...
4
2226
by: peterv6 | last post by:
I'm having problems writing records to an output file. When I do it in Textpad running on Windows, the output file looks fine. When, however, I copy the script to a Linux machine and use the exact...
0
1298
by: Darren Mansell | last post by:
On Mon, 2008-11-17 at 15:24 +0000, Tim Golden wrote: Thanks for the help. Unfortunately pyodbc seems to only work on Windows. I need to connect to the SQL server from a Linux box. The db...
3
5354
by: rahullko05 | last post by:
Hi, I am trying to write japanese character in text file (actually trying to create a shell file), to execute some exe placed at that location. Please help me with this, i need some solution...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7208
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5464
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4915
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4593
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1423
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.