473,396 Members | 2,129 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,396 software developers and data experts.

Cannot build a string containing the < character

I'm facing a crazy problem:

<%
spc = "<abcd"
response.write spc
%>

will not work, spc is empty.
When I replace <abcd with ab<cd, then spc contains only ab.

Where do I make the mistake ?
Pierrot

Jan 13 '06 #1
3 1337
Basically you are not making any mistake. If you would view the source
code of the page generated you will see the < sign. However the browser
interprets the < with a html tag. If you want to show the < as text,
you can use &lt; definition.

So in your case:

spc = "&lt;abcd" which will render in the browser as <abcd
Giganews wrote:
I'm facing a crazy problem:

<%
spc = "<abcd"
response.write spc
%>

will not work, spc is empty.
When I replace <abcd with ab<cd, then spc contains only ab.

Where do I make the mistake ?
Pierrot


Jan 13 '06 #2
Server.HTMLEncode is another way of not having to worry about special
characters not shoping.

Response.Write Server.HTMLEncde(spc)

Ray at work

"Giganews" <ph@email.no> wrote in message
news:V8********************@giganews.com...
I'm facing a crazy problem:

<%
spc = "<abcd"
response.write spc
%>

will not work, spc is empty.
When I replace <abcd with ab<cd, then spc contains only ab.

Where do I make the mistake ?
Pierrot

Jan 13 '06 #3
No big deal but minor typo:
Response.Write Server.HTMLEncde(spc)

To be:
Response.Write Server.HTMLEncode(spc)

Best regards,
-Paul
www.Bullschmidt.com - Freelance Web and Database Developer
www.Bullschmidt.com/DevTip.asp - ASP Design Tips

Jan 16 '06 #4

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

Similar topics

4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
7
by: tuchka | last post by:
Hi, guys! I am very new here and just started to learn C. I have previous java exp. however. I'm abs. stuck on pointers and i'm unable comprehend algorithm of simple program that reverses chars...
6
by: karthi | last post by:
hi, I need user defined function that converts string to float in c. since the library function atof and strtod occupies large space in my processor memory I can't use it in my code. regards,...
5
by: Minkoo Seo | last post by:
Hi list. I'd like to print a line "" given a vector<string> containing "A", "BC", "D", "EF". The following code is what I've written for this purpose: #include <iostream> #include <vector>
8
by: gthorpe | last post by:
Hi, I have a question about string constants. I compile the following program: #include <stdio.h> #include <string.h> int main(void) { char str1 = "\007";
3
by: John Nagle | last post by:
I have XML replies in a DOM which contain entity escapes, like "&amp;". What's the proper way to replace them with the ordinary characters? Preferably something that will work in most browsers? I...
5
by: Hels Bells | last post by:
Hi, I'm looking to do some manipulation on a string containing html code in asp which will involve me either using some regular expressions or just plain old simple replace functionality. The...
6
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello, I have some XML that is returned to my application from another vendor that I cannot change before it gets to me. I can only alter it after it gets to my application. That being said, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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
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,...
0
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...

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.