[FIX] isSafeForHttp. ~ is not safe!

Giovanni Giorgi jj at objectsroot.com
Wed Jun 2 13:29:01 UTC 2004

Hi all,
    I have found a small bug in the http encoding.
The tilde character (~) is unsafe for the http protocol and must be encoded:
I have attached a small fix.
It seems work well.
To check if your system works right eval
    'tilde=~' encodeForHTTP
you must get:

Ciao ciao!

  [   [  [ JJ ]  ]   ]  | First, they ignore you. Then they laugh  
                        | at you. Then they fight you. Then you win
http://www.siforge.org  |          Mahatma Ghandi

-------------- next part --------------
'From Squeak3.6 of ''6 October 2003'' [latest update: #5429] on 2 June 2004 at 3:18:58 pm'!

!Character methodsFor: 'testing' stamp: 'gg 6/2/2004 15:18'!
	"whether a character is 'safe', or needs to be escaped when used, eg, in a URL"
	"[GG]  See http://www.faqs.org/rfcs/rfc1738.html. ~ is unsafe and has been removed"
	^ value < 128
		and: [self isAlphaNumeric
				or: ['.-_' includes: self]]! !

More information about the Squeak-dev mailing list