HTMLUtilities.st
changeset 2179 c1cee8bbc1e5
parent 2144 c89258333f4d
child 2434 5625df4b6119
equal deleted inserted replaced
2178:f6f0d919aed2 2179:c1cee8bbc1e5
   171             ifFalse:[
   171             ifFalse:[
   172                 c == $% 
   172                 c == $% 
   173                     ifTrue: [
   173                     ifTrue: [
   174                         peekC := rs peek.
   174                         peekC := rs peek.
   175                         (peekC notNil and:[peekC isHexDigit]) ifTrue:[
   175                         (peekC notNil and:[peekC isHexDigit]) ifTrue:[
   176                             c := (Integer readFrom:(rs next:2) radix:16) asCharacter 
   176                             c := (Integer readFrom:(rs nextAvailable:2) radix:16) asCharacter 
   177                         ] ifFalse:[
   177                         ] ifFalse:[
   178                             c := rs next.
   178                             c := rs next.
   179                         ]
   179                         ]
   180                     ]
   180                     ]
   181             ].
   181             ].
   182         ws nextPut: c.
   182         c notNil ifTrue:[ ws nextPut: c ].
   183     ].
   183     ].
   184     ^ ws contents
   184     ^ ws contents
   185 
   185 
   186     "
   186     "
   187      self unEscape:'a%20b'   
   187      self unEscape:'a%20b'   
   188      self unEscape:'a%%b'
   188      self unEscape:'a%%b'
   189      self unEscape:'a+b' 
   189      self unEscape:'a+b' 
   190      self unEscape:'a%+b' 
   190      self unEscape:'a%+b' 
   191     "
   191      self unEscape:'a%' 
       
   192      self unEscape:'a%2' 
       
   193     "
       
   194 
       
   195     "Modified: / 08-07-2009 / 12:40:56 / sr"
   192 !
   196 !
   193 
   197 
   194 urlEncoded: aString
   198 urlEncoded: aString
   195     "helper to escape invalid/dangerous characters in an urls arguments or post-fields.
   199     "helper to escape invalid/dangerous characters in an urls arguments or post-fields.
   196         see: application/x-www-form-urlencoded
   200         see: application/x-www-form-urlencoded
   355 ! !
   359 ! !
   356 
   360 
   357 !HTMLUtilities class methodsFor:'documentation'!
   361 !HTMLUtilities class methodsFor:'documentation'!
   358 
   362 
   359 version
   363 version
   360     ^ '$Header: /cvs/stx/stx/libbasic2/HTMLUtilities.st,v 1.5 2009-05-07 13:26:59 cg Exp $'
   364     ^ '$Header: /cvs/stx/stx/libbasic2/HTMLUtilities.st,v 1.6 2009-07-08 10:40:24 sr Exp $'
   361 ! !
   365 ! !