Showing all spaces without using the  

Discussion in 'ASP General' started by Nathan Sokalski, Jul 2, 2004.

  1. 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, Jul 2, 2004
    1. Advertisements

  2. Nathan Sokalski

    Jeff Cochran Guest

    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 Cochran, Jul 2, 2004
    1. Advertisements

  3. Please only post to one newsgroup. You'll find that it makes life easier
    for everyone.
    David C. Holley, Jul 2, 2004
  4. 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, Jul 2, 2004
  5. Nathan Sokalski

    AStr Guest

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

    AStr, Jul 2, 2004
  6. Nathan Sokalski

    Jeff Cochran Guest

    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 Cochran, Jul 2, 2004
  7. Nathan Sokalski

    McKirahan Guest

    Write a function to only replace only the leading spaces of each line using
    a regular expression.
    McKirahan, Jul 5, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.