equal
deleted
inserted
replaced
216 |
216 |
217 urlEncode2:aStringOrStream on:ws |
217 urlEncode2:aStringOrStream on:ws |
218 "helper to escape invalid/dangerous characters in an urls arguments. |
218 "helper to escape invalid/dangerous characters in an urls arguments. |
219 Similar to urlEncode, but treats '*','~' and spaces differently. |
219 Similar to urlEncode, but treats '*','~' and spaces differently. |
220 (some clients, such as bitTorrent seem to require this - time will tell...) |
220 (some clients, such as bitTorrent seem to require this - time will tell...) |
221 Any byte not in the set 0-9, a-z, A-Z, '.', '-', '_' and '~', is encoded using |
221 Any byte not in the set 0-9, a-z, A-Z, '.', '-', '_', is encoded using |
222 the '%nn' format, where nn is the hexadecimal value of the byte. |
222 the '%nn' format, where nn is the hexadecimal value of the byte. |
223 see: RFC1738" |
223 see: RFC1738" |
224 |
224 |
225 |rs c space| |
225 |rs c space| |
226 |
226 |
228 rs := aStringOrStream readStream. |
228 rs := aStringOrStream readStream. |
229 |
229 |
230 [rs atEnd] whileFalse: [ |
230 [rs atEnd] whileFalse: [ |
231 c := rs next. |
231 c := rs next. |
232 |
232 |
233 (c isLetterOrDigit or:[ ('-_.~' includes:c) ]) ifTrue:[ |
233 (c isLetterOrDigit or:[ ('-_.' includes:c) ]) ifTrue:[ |
234 ws nextPut:c. |
234 ws nextPut:c. |
235 ] ifFalse:[ |
235 ] ifFalse:[ |
236 ws nextPut: $%. |
236 ws nextPut: $%. |
237 c codePoint printOn:ws base:16 size:2 fill:$0. |
237 c codePoint printOn:ws base:16 size:2 fill:$0. |
238 ]. |
238 ]. |
239 ]. |
239 ]. |
240 |
240 |
241 "Created: / 09-01-2011 / 10:32:27 / cg" |
241 "Created: / 09-01-2011 / 10:32:27 / cg" |
|
242 "Modified: / 09-01-2011 / 13:11:17 / cg" |
242 ! |
243 ! |
243 |
244 |
244 urlEncode:aStringOrStream on:ws |
245 urlEncode:aStringOrStream on:ws |
245 "helper to escape invalid/dangerous characters in an urls arguments or post-fields. |
246 "helper to escape invalid/dangerous characters in an urls arguments or post-fields. |
246 Similar to urlEncode2, but treats '*','~' and spaces differently. |
247 Similar to urlEncode2, but treats '*','~' and spaces differently. |
494 ! ! |
495 ! ! |
495 |
496 |
496 !HTMLUtilities class methodsFor:'documentation'! |
497 !HTMLUtilities class methodsFor:'documentation'! |
497 |
498 |
498 version |
499 version |
499 ^ '$Header: /cvs/stx/stx/libbasic2/HTMLUtilities.st,v 1.13 2011-01-09 09:47:13 cg Exp $' |
500 ^ '$Header: /cvs/stx/stx/libbasic2/HTMLUtilities.st,v 1.14 2011-01-09 12:11:36 cg Exp $' |
500 ! |
501 ! |
501 |
502 |
502 version_CVS |
503 version_CVS |
503 ^ '$Header: /cvs/stx/stx/libbasic2/HTMLUtilities.st,v 1.13 2011-01-09 09:47:13 cg Exp $' |
504 ^ '$Header: /cvs/stx/stx/libbasic2/HTMLUtilities.st,v 1.14 2011-01-09 12:11:36 cg Exp $' |
504 ! ! |
505 ! ! |