Forum Moderators: open
Note: The WebmasterWorld posting software deletes spaces preceding the exclamation point "!" character. It also replaces a solid vertical pipe symbol with a broken vertical pipe "¦" symbol. Both of these changes will need to be undone in any code you copy from WebmasterWorld. Make sure to include a space preceding the "!" in mod_rewrite code, and always replace "¦" with a solid vertical pipe.
This is an excellent note that should be present in all threads about mod_rewrite. Sometimes I wrote a warning to this effect, sometimes I forgot to do so. When I did forget it, it turned out to be a problem for a lot of new users.
Perhaps Brett could make this note available as a style tag. Then all one would need to do is add [ bpn ] for broken pipe notice to one´s post.
Another useful tag would be [ wc ]name[ /wc ] which would expand to Welcome to WebmasterWorld [webmasterworld.com] name. That would be so much easier and one would not have to search for paynt´s welcome thread anymore ;)
Andreas
The broken pipe is ASCII 166. The solid vertical pipe symbol, that´s the one you need to syntactically separate alternatives in regular expressions is ASCII 124. On a German keyboard you get it by pressing Alt Gr + <.
perl -e '$_="Aaron"; print /aaron¦nick/i;'If you copy this code and try to execute it this will print nothing, since it will look for the string aaron¦nick which isn´t there. What you really want is this:
perl -e '$_="Aaron";$pat=join(chr(124),'aaron','nick');print /$pat/io;'Of course this could be simply written as
perl -e '$_="Aaron"; print /aaron¦nick/i;'but then there is the problem again that there seems to be no way to express chr(124) using the forum software.
Hope this helps.
Andreas
I have pasted the following code here control panel/System Preferences/Custom Code Insert Bottom? field : <p>[*url=http://www.webmasterworld.com/forum19/542.htm]Welcome to WebmasterWorld, [/url] </p> (without the "*")
This keeps paynt's welcome post handy.
If any miss any other button on top or at bottom of pages, we are allowed up to 1000 characters to customise at will.
I can't tell you what the ASCII codes are, but this "¦" character was typed as a standard, keyboard-entered pipe symbol on my keyboard, and originally appeared in the edit window as a solid (unbroken) vertical pipe symbol. When I clicked Preview, it then appeared in modified form as a broken vertical pipe (what you see now) in both the preview screen at top and the edit box below. If the post is directly Submitted without Previewing, the change also occurs.
If a user cuts and pastes the text into a file, and then edits it, typing that same keyboard key to replace it will fix it. This is mostly a problem for posting code here; For example, it will blow up a PERL script to have the wrong character in there.
The space-exclamation-point problem makes it impossible to correctly quote a previously-posted .htaccess directive containing "..HOST} !^mydomain.." or similar, because it will strip the space and make the syntax illegal. I type them with two spaces now, so one remains in the original post. However, it's easy to forget to do that work-around. I would beg for the suspension of this space-eating rule inside bbcode
[code] tags when the space precedes any printable (non-whitespace) character. Trimming multiple spaces preceding exclamation point down to one space in this case would be fine, but trimming to zero spaces causes the syntax problem. Thanks!
Jim
perl -e '$_="Aaron";$pat=join(chr(124),'aaron¦nick');print /$pat/io;'won´t work since the single quote before aaron will end the code that perl executes.
perl -e '$_="Aaron";$pat=join(chr(124),"aaron¦nick");print /$pat/io;'does work but will print nothing. It is the same as
perl -e '$_="Aaron";print /aaron¦nick/io;'since there is nothing to join. We do not get the vertical bar character.
Only this will print 1 since only this code tells the regular expression engine to look for a string of either aaron or nick:
perl -e '$_="Aaron";$pat=join(chr(124),"aaron","nick");print /$pat/io;'
Andreas
<script src="http://server/ww_js.js"></script>
<a href="#" onclick="wc();">Welcome</a>
<a href="#" onclick="bpn();">BPN</a>
Your ww_js.js needs to look like this.
function wc() {
document.forms[0].post.value='[ url=http://www.webmasterworld.com/forum19/542.htm ]Welcome to WebmasterWorld[ /url ] '+document.forms[0].post.value;
return false;
}
function bpn() {
document.forms[0].post.value=document.forms[0].post.value+'Note: The WebmasterWorld posting software deletes spaces preceding the exclamation point "!" character. It also replaces a solid vertical pipe symbol with a broken vertical pipe "&" symbol. Both of these changes will need to be undone in any code you copy from WebmasterWorld. Make sure to include a space preceding the "!" in mod_rewrite code, and always replace "&" with a solid vertical pipe.';
return false;
}
The external JavaScript is just used to overcome the 500 character limitation of the Custom Code fields.
The welcome will be added to the top of the post. The broken pipe notice will be added at the bottom of the post.
You will need to remove the spaces around the [ url ] tag.
Andreas
¦testing¦
The pipes on either side of the word "testing" were typed in as solid pipes...
<added>and after I clicked submit on the post, they appear as solid pipes in my post...</added>
I used various browsers (IE6, Moz1.2, NS6, NS7, Op5, Op6, Lynx both under WindowsNT, Win98, Linux) and always get the brocken bar (ASCII 166 - Unicode 00A6 [unicode.org]) instead of the vertical bar (ASCII 124 - Unicode 007C [unicode.org]).
If you try to validate this page [validator.w3.org] the validator complains about the missing character encoding.
When Latin-1, which is the HTTP default character encoding, is choosen manually [validator.w3.org], the validator sees the brocken bar as well. Never mind the actual validation error. This is just because of my javascript code.
How do I know that this (the broken bar) is really what the validator sees? When you choose UTF-8 the server will turn the brocken bar into the named entity ¦ which is the broken vertical bar.
Brett, do you see only the normal not broken bar as well?
Brett and Mivox, what do you get when you copy perl -e 'print ord("¦")' to the command line and execute it?
Before posting I get 124, after posting this will show 166.
Andreas
Nah, I'm not doing the unicode thing here at all. We've tried and it was nothing but trouble - there are no fixes for that in sight when you are dealing with no less than 14 major browsers and regular members from 55 countries that visit daily. It would take two months of solid work to even come close to getting it right. I'm not opening myself or the board up to those problems. I'll let the browsers figure it out.
Would this problem go away if WebmasterWorld declared a character set in the server headers or on the pages themselves using http-equiv? From a view-page-source and server header check on this page, it appears that no character set is declared, so I'm guessing that all of our different browser and default charset selections may lead to the seemingly-random "works/doesn't work for me" results.
Some of the mystery has been revealed, at least! :)
Jim