![]() |
|
#1
|
|||
|
|||
|
Okay, I got a simple question about XHTML validation. If I code something on a webpage and it has no error on XHTML 1.0 on tags and everything else but it will throw errors because of the contents that may contain special characters like... '/"/&/</>/%/ those XHTML requires you to do it with * and such, right? But, what if the content is dynamic and it is being generated via something else; server side and such. what do I do then?
Some pages will be XHTML 1.0 validated; some won't. Thanks. |
|
#2
|
|||
|
|||
|
That is a prob w/ xhtml. & (& nbsp
is such a pain..You could you a function to change the commonly used characters into their long forms and then send the output to the client... |
|
#3
|
|||
|
|||
|
<blockquote id="quote"><span class="smalltext" id="quote">quote:<hr id="quote">Originally posted by Abhi
That is a prob w/ xhtml. & (& nbsp is such a pain..You could you a function to change the commonly used characters into their long forms and then send the output to the client... <hr id="quote"></blockquote id="quote"></span id="quote"> do you have one for PHP? or anyone else? |
|
#4
|
|||
|
|||
|
something like this:
<% function format(str) { return String( str ).split('&').join('*'); } while( !rs.eof ) { Response.Write( format( rs("sLog").value ) ); rs.movenext(); } %> |
|
#5
|
|||
|
|||
|
ok the space in the join is a & nbsp;
|
|
#6
|
|||
|
|||
|
|
|
#7
|
|||
|
|||
|
bingo.
[url="http://chrispoole.com"]Chris[/url:7k9fhkxvdz] |
|
#8
|
|||
|
|||
|
<blockquote id="quote"><span class="smalltext" id="quote">quote:<hr id="quote">You could just use HTML.<hr id="quote"></blockquote id="quote"></span id="quote">
How would that help? If I understand Syedur right, he's having problems with '&' and '<' which has to be encoded as e.g. & and < repectively. But this has to be done in HTML too. <font face="Courier New">-- David</font id="Courier New"> |
|
#9
|
|||
|
|||
|
Agreed with David!
I am not trying to change anything but trying to extract some &, " and ' quotes into long format HTML. So, when the page is being valid by XHTML 1.0 validation. Abhi, thanks but your script isn't working...maybe I just need some direction on using it. |
|
#10
|
|||
|
|||
|
It should this does,
var txt = "abhi & me"; function format( s ) { return String( s ).split('&').join('*'); // you'll see a space in the join argument, thats is an &nbs p; } format( txt ); |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|