[Seaside] [BUG][FIX] String>>seaEscapeHtml

Alain Fischer alain.fischer@bluewin.ch
Sun, 24 Mar 2002 22:10:17 +0100


If you try to evaluate: "(String with: 0 asCharacter) seaEscapeHtml",
you get a Walkback. To fix this, I have modified the method:
- at the end: (entities at: c asciiValue) -> (entities at: c=20
asciiValue + 1)
- added an empty string at the begining of entities array

seaEscapeHtml
	| stream entities|
	entities _ 	#('' '=01' '=02' '=03' '=04' '=05' '=06' '=07' =
'=08' '	' '
' '=0B' '=0C' '
' '=0E' '=0F' '=10' '=11' '=12' '=13' '=14' '=15' '=16' '=17' '=18' '=19' =
'=1A' '=1B' '=1C' '=1D' '=1E'=20
'=1F' ' ' '!' '"' '#' '$' '%' '&' '''' '(' ')' '*' '+' ',' '-' '.' =
'/'=20
'0' '1' '2' '3' '4' '5' '6' '7' '8' '9' ':' ';' '<' '=3D' '>' '?'=20=

'@' 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q'=20=

'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' '[' '\' ']' '^' '_' '`' 'a' 'b' 'c'=20=

'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 'u'=20=

'v' 'w' 'x' 'y' 'z' '{' '|' '}' '~' '=7F' 'Ä' 'Å' 'Ç'=20=

'É' 'Ñ' 'Ö' 'Ü' 'á' 'à' 'â'=20=

'ä' 'ã' 'å' 'ç' 'é' 'è' 'ê'=20=

'ë' 'í' 'ì' 'î' 'ï' 'ñ' 'ó'=20=

'ò' 'ô' 'ö' 'õ' 'ú' 'ù' 'û'=20=

'ü' '¹' '°' '¢' '£' '§' '=C7' '¶'=20
'ß' '®' '©' '=E9' '´' '¨' '­' 'Æ'=20
'Ø' '=E7' '±' '²' '³' '¥' 'µ' =
'¦'=20
'·' '¸' ' ' '¼' 'ª' 'º' '½'=20
'æ' 'ø' '¿' '¡' '¬' '=ED' '=C4' '=C5' '=E5'=20=

'«' '»' '=C9' '¾' 'À' 'Ã' 'Õ' =
'=EB'=20
'=EC' 'Ð' '=D1' '=F1' '=EE' '=EF' '=EA' '÷' '×' =
'ÿ' 'Ý'=20
'=F2' '=F3' '=DC' '=F4' 'Þ' '¤' '=E0' '=E1' '=E2' '=E3' '=E4'=
 'Â'=20
'Ê' 'Á' 'Ë' 'È' 'Í' 'Î' 'Ï'=20=

'Ì' 'Ó' 'Ô' 'ð' 'Ò' 'Ú' 'Û'=20=

'Ù' '=F5' '=F6' '=D6' '=E8' '=F9' '=FA' '=FB' '=FC' 'ý' =
'þ'=20
'&hibar;').
	=09
	stream _ WriteStream on: String new.
	self do: [:c| stream nextPutAll: (entities at: c asciiValue + =
1)].		=09
					=09
	^ stream contents asString