all groups > dotnet academic > may 2004 >
You're in the

dotnet academic

group:

The "code" for "<br>" in plain text


" in plain text -- dotnet academic ">
The "code" for "<br>" in plain text Svein Erik Storkas via .NET 247
5/14/2004 11:18:23 AM
dotnet academic: I am developing a weblog. I have a textfield where you write the blog (content). Then i send the text via a WebService method I have created.

The problem is: How do I make the text show exactly the same way as the user wrote the blog? My only problem is that the paragraphs and more than 1 whitespace do not show.

I have a method which replaces "\n" with "<br>", but it does work, i guess it is not "\n" that is used..?

(it works if i write "<br>" directly in the blog, but i want it to do it automatically of course:) )

Can someone help?


--------------------------------
From: Svein Erik Storkas

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

RE: The "code" for "<br>" in plain text Radoslav Ivanov
5/15/2004 11:01:04 AM
Hi,
I suppose your problem is in that you only replace newlines, while when you hit [ENTER] this cause
different operations on different systems. For example on Windows it sends a "\r\n" after each [ENTER]
Hope this helps

Radoslav Ivano

----- Svein Erik Storkas via .NET 247 wrote: ----

I am developing a weblog. I have a textfield where you write the blog (content). Then i send the text via a WebService method I have created

The problem is: How do I make the text show exactly the same way as the user wrote the blog? My only problem is that the paragraphs and more than 1 whitespace do not show

I have a method which replaces "\n" with "<br>", but it does work, i guess it is not "\n" that is used..

(it works if i write "<br>" directly in the blog, but i want it to do it automatically of course:)

Can someone help


-------------------------------
From: Svein Erik Storka

----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/

Re: The "code" for "<br>" in plain text Eric Marvets
5/21/2004 9:56:29 PM
It may depend on the character being used to make a new line on the system
running the blog. For example, it could be a carriage return, or carriage
return & line feed. Use the string.split method and try passing in
different ControlChars.xxx values until it breaks the string up.

You can then join the array of strings back together with <BR> placed
inbetween.

--
Eric Marvets
Principal Consultant

the bang project

<shameless self promotion>

Email sales@bangproject.com for Information on Our Architecture and
Mentoring Services

</shameless self promotion>

AddThis Social Bookmark Button