472,958 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Showing all spaces without using the  

I am using ASP to read code from a text file that I am displaying on my
page. Because I do not want the code from the text file to be executed, I
used the Server.HTMLEncode() method to display it as it is in the file.
However, the spaces used to indent lines is still removed by the browser. I
cannot use VBScript's replace function to replace all spaces with  
because that would replace all spaces, including ones that I do not want
replaced as well as majorly increasing the size of my file. Is there any
way to display the spaces used to indent the lines without manually writing
a function to do it? Thank You.
--
Nathan Sokalski
nj********@hotmail.com
www.nathansokalski.com


Jul 19 '05 #1
6 3138
On Thu, 1 Jul 2004 19:59:51 -0400, "Nathan Sokalski"
<nj********@hotmail.com> wrote:
I am using ASP to read code from a text file that I am displaying on my
page. Because I do not want the code from the text file to be executed, I
used the Server.HTMLEncode() method to display it as it is in the file.
However, the spaces used to indent lines is still removed by the browser. I
cannot use VBScript's replace function to replace all spaces with &nbsp;
because that would replace all spaces, including ones that I do not want
replaced as well as majorly increasing the size of my file. Is there any
way to display the spaces used to indent the lines without manually writing
a function to do it?


Yes. First, don't post to so many groups. This isn't DHTML or an ASP
component. It doesn't involve the HTML object model, and isn't
related to the SDK's. It's not even server side, so the ASP group is
also technically out. In fact, none of the groups you selected are
actually appropriate.

Look at the <pre></pre> tags in HTML. Google for a reference if you
don't understand them, or repost in a HTML group.

Jeff
Jul 19 '05 #2
Please only post to one newsgroup. You'll find that it makes life easier
for everyone.

Nathan Sokalski wrote:
I am using ASP to read code from a text file that I am displaying on my
page. Because I do not want the code from the text file to be executed, I
used the Server.HTMLEncode() method to display it as it is in the file.
However, the spaces used to indent lines is still removed by the browser. I
cannot use VBScript's replace function to replace all spaces with &nbsp;
because that would replace all spaces, including ones that I do not want
replaced as well as majorly increasing the size of my file. Is there any
way to display the spaces used to indent the lines without manually writing
a function to do it? Thank You.


Jul 19 '05 #3
What about making long lines wrap around? Some lines in code (such as HTML
tags with a lot of attributes) will be too long to fit on one line, but the
PRE tag prevents text wrap. Based on the website I usually use as a
reference, the width attribute (which sets the maximum characters in a line)
is deprecated, but it does not state what technology is used in it's place.
I can use it, but I prefer not to use deprecated attributes. Any ideas?

(I apologize for sending to multiple newsgroups. I tend to do that because
some groups are rarely used, I don't always know which group is the precise
one I want, and I don't want to subscribe to ALL newsgroups. I will do my
best to lessen this habit)
--
Nathan Sokalski
nj********@hotmail.com
www.nathansokalski.com

"Jeff Cochran" <je*********@zina.com> wrote in message
news:40****************@msnews.microsoft.com...
On Thu, 1 Jul 2004 19:59:51 -0400, "Nathan Sokalski"
<nj********@hotmail.com> wrote:
I am using ASP to read code from a text file that I am displaying on my
page. Because I do not want the code from the text file to be executed, I
used the Server.HTMLEncode() method to display it as it is in the file.
However, the spaces used to indent lines is still removed by the browser. Icannot use VBScript's replace function to replace all spaces with &nbsp;
because that would replace all spaces, including ones that I do not want
replaced as well as majorly increasing the size of my file. Is there any
way to display the spaces used to indent the lines without manually writinga function to do it?


Yes. First, don't post to so many groups. This isn't DHTML or an ASP
component. It doesn't involve the HTML object model, and isn't
related to the SDK's. It's not even server side, so the ASP group is
also technically out. In fact, none of the groups you selected are
actually appropriate.

Look at the <pre></pre> tags in HTML. Google for a reference if you
don't understand them, or repost in a HTML group.

Jeff

Jul 19 '05 #4
"Nathan Sokalski" wrote...
I am using ASP to read code from a text file that I am displaying on my
page. Because I do not want the code from the text file to be executed, I
used the Server.HTMLEncode() method to display it as it is in the file.
However, the spaces used to indent lines is still removed by the browser. I
cannot use VBScript's replace function to replace all spaces with &nbsp;
because that would replace all spaces, including ones that I do not want
replaced as well as majorly increasing the size of my file. Is there any
way to display the spaces used to indent the lines without manually writing
a function to do it? Thank You.


Use <pre> tag or, if the whole your page is just text,
assign "text/plain" mime type to it.

HTH

--
Alex Streletsky
Brainbench MVP for HTML
http://www.brainbench.com/
Jul 19 '05 #5
On Fri, 2 Jul 2004 02:28:12 -0400, "Nathan Sokalski"
<nj********@hotmail.com> wrote:
What about making long lines wrap around? Some lines in code (such as HTML
tags with a lot of attributes) will be too long to fit on one line, but the
PRE tag prevents text wrap. Based on the website I usually use as a
reference, the width attribute (which sets the maximum characters in a line)
is deprecated, but it does not state what technology is used in it's place.
I can use it, but I prefer not to use deprecated attributes. Any ideas?


Plenty. But again, it's not an ASP issue. It's a client-side display
issue. Try a client-side HTML group for solutions.

Jeff
Jul 19 '05 #6
"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:#D**************@TK2MSFTNGP09.phx.gbl...
I am using ASP to read code from a text file that I am displaying on my
page. Because I do not want the code from the text file to be executed, I
used the Server.HTMLEncode() method to display it as it is in the file.
However, the spaces used to indent lines is still removed by the browser. I cannot use VBScript's replace function to replace all spaces with &nbsp;
because that would replace all spaces, including ones that I do not want
replaced as well as majorly increasing the size of my file. Is there any
way to display the spaces used to indent the lines without manually writing a function to do it? Thank You.
--
Nathan Sokalski
nj********@hotmail.com
www.nathansokalski.com

Write a function to only replace only the leading spaces of each line using
a regular expression.
Jul 19 '05 #7

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

Similar topics

12
by: Tjerk Wolterink | last post by:
In XHTML the entity nbsp stands for   A normal space like " " is also displayed as an normal space, but multiple spaces like " " are interpreted as 1 space in the xhtml page. So there comes...
12
by: Robert Mark Bram | last post by:
Hi All, I am using the following trim function: function trim (str) { return str.replace(/^\s*/g, '').replace(/\s*$/g, ''); } The problem is that this doesn't trim instances of the...
5
by: Naveen K Kohli | last post by:
I am try to set the text of the drop down list item as ListItem li = new ListItem(); li.Text = "&nbsp;"+"MyValue"; myDropDown.Items.Add("li); The intent is to add a spacing in front of the...
2
by: Rob T | last post by:
I have a dropdown list that I would like to put in a bunch of &nbsp;'s into it (I'm setting the font to a monospace font so I can show a couple of columns nice and neat). In the old asp days, I...
1
by: Vikram | last post by:
i am adding a row in dataset , in which i want to add &nbsp; (space chracter for html) and then want to bind dataset to asp.net dropdown list box. But & automatically converted to &amp chracter....
3
by: yawnmoth | last post by:
<? echo 'a'.trim(html_entity_decode('&nbsp;a&nbsp;')).'a'; ?> Shouldn't PHP output aaa? Looking at the documentation for trim I see that it doesn't support chr(0xA0) (eg....
2
by: takinduro | last post by:
Hi, I would like to take a user's input, and store just as they write it in the textbox into my database. So basically, if a user enters test and then hits the space bar twice and then continues...
9
hsriat
by: hsriat | last post by:
I have to toggle the name of a hyperlink from Edit to Save and vice-versa on click event of the same hyperlink. This is the HTML part, <input class="text" id="ix1" type=text></input> <a...
1
by: anilraghuvanshi | last post by:
Hi All, We are displaying some text in text box coming from database. We set this value in text box using one Js function. problem is that the string is like "My Name" having <space> beteen them...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.