473,563 Members | 2,635 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,Destin ation)
FullFilename = server.mappath( Filename)
set fs = CreateObject("S cripting.FileSy stemObject")
set file = fs.OpenTextFile (FullFilename, 2, true)
FileText = ""
FileText = FileText & "<%" & vbcrlf
FileText = FileText & "Response.Statu s = ""301 Moved Permanently""" &
vbcrlf
FileText = FileText & "Response.addhe ader ""Location"","" " & Destination
& """ & vbcrlf
FileText = FileText & "Response.E nd" & vbcrlf
FileText = FileText & "%>" & vbcrlf
file.WriteLine( FileText)
file.Close()
set fs = nothing
end function
Jul 22 '05 #1
5 1864

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******** ************@ph obos.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.publi c.inetserver.as p.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******** ******@TK2MSFTN GP09.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
9814
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' not 'unicode' so I tried to just record.replace('Â', '') but this does nothing. However the following code works
1
3237
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 "Data" box and not the "Description" box - not very user friendly!! I have no trouble at all in writing to the Windows NT Application Log.
2
4184
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 Shared Function WriteErrorToLog(ByVal objError As System.Text.StringBuilder, ByVal strSource As String) As Boolean Dim objEL As New EventLog Dim...
2
3810
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
846
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 using the tracing). How did you solve this type of problems ? Thank you.
7
4558
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 example below: 1. the word "sécurité" comes out of my db 2. I construct the following link, using the php urlencode function: <a...
4
2234
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 same code, it appends a ^M character on each line written to the file. I have no idea why this is happening. I'm writing to the file by redirecting...
0
1307
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 schema is very set in stone, I can't do anything with it. I'm currently opening autogenerated SQL scripts, decoding them from utf-16 and then back into...
3
5362
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 very urgently. fyi, i am using this code to read unicode character from another file. String triggerFilePath = "/" + "BuildCopy" + File.separator +...
0
7659
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7945
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2079
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 we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.