![]() |
|
|
|
|
|
|
62
5th November 02:45
External User
Posts: 1
|
I just added the trim() part in the third box down.
AFAICT it works like it should. See for yourself. http://www.cmsws.com/examples/html/form_encoding.php Here is the output that I get with FF 2.0.0.11 _POST data is: Name is submit 0000 A0 20 A0 20 43 6C 69 63 6B 20 4D 65 21 20 A0 20 ....Clic k.Me!... 0010 A0 . What do you get? -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare |
|
|
63
5th November 02:45
External User
Posts: 1
|
It's because I have a tester.
You see, it's easy to say "Nope, that don't work." But, it's much harder to find a solution. Finding a solution is usually best served when one doesn't under estimate the problem, as many here have already demonstrated. As it turns out, this problem is more complex than any of us has been able to fathom thus far. When a string containing non-breaking spaces is sent via a POST, what do those non-breaking spaces become? It's clear that they are not spaces, nor are they To find out, I did put the operation through FireFox and reversed the POST/GET operations to get a look at the string -- it is: %C2%A0%C2%A0%C2%A0Z%C2%A0%C2%A0%C2%A0 < where Z is the value passed. Now, C2 (HEX) is a linefeed (194 DEC) And, A0 (HEX) is a non-breaking space (160 DEC which is a Therefore, if I simply use: $submit = str_replace( chr(194), '', $submit ); $submit = str_replace( chr(160), '', $submit ); This is the solution. Now, why does a POST operation add in C2's? I'll leave that for another post. :-) Thanks everyone for your time. I hope we all learned something, I did. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com |
|
|
64
5th November 02:46
External User
Posts: 1
|
That depends upon what Text Encoding my browser is set to.
However, the point is moot. I just tried a variation of your code, namely: $submit = trim($submit, "\xA0\xC2"); And it worked. So you were on the right track, just using the wrong HEX. See my SOLVED post. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com |
|
|
66
5th November 02:47
External User
Posts: 1
|
I didn't mean it that way. I meant for my current logic, I need the
value of the submit button to be 'A'. I have much more going on here than just that. I have over 40 different values for the submit button and a switch statement that uses what's submitted. I don't want to, and see no reason to, change it. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com |
|
|
|
|
68
8th November 03:48
External User
Posts: 1
|
Well considering that UTF-8 encompasses/includes all of the code
points found ISO-8859, then I think that both encodings would reference the same character. After all, if they didn't then what's the point of Unicode? Now, one can argue how many bytes are needed to represent a character in what encoding, but that doesn't change the character. In the end, I believe that <A0> is the same regardless of what charset or encoding you're using. I just don't understand where C2 comes from or why it's there. I would think that <00 A0> would be more appropriate. If you mean my solution doesn't work, then you are mistaken -- for works for me. That's a valid point. Not only the encoding that's declared for the page via it's html DOCTYPE, but also what encoding was used to actually save that file on the server. This entire encoding process is more involved than it looks, or so it appears to me. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com |
|
|
69
8th November 03:48
External User
Posts: 1
|
D'oh!
Of course in the browser is converted to a single character, whose ASCII (extended ASCII, actually) value is 160. trim() does not consider chr(160) as whitespace, unless you explicitly add it in the second arg, along with the usual suspects. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? |
|
|
70
8th November 03:48
External User
Posts: 1
|
http://www.l-i-e.com/a/
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? |
|