Martin Mavrov - 2002-04-24

Logged In: YES
user_id=344902

I admit that the patch was short-sighted. Here is a more
complete version:

else if (k==2) {
int length = t.length();
if (
i >= length - 3 // can't hold "&#;"
|| t.charAt(i + 1)!= '#') // isn't #
{
b.append(E[k]);
continue;
}

int j = i + 2;
boolean hexMode = false;

char ch = t.charAt(j);

if (ch == 'x') {
hexMode = true;
j++;
}

while (
j < length
&& (ch = t.charAt(j)) != ';'
&& (hexMode ?

("0123456789ABCDEFabcdef".indexOf(ch) != -1) :
("0123456789".indexOf(ch) !
= -1)
)
)
{
j++;
}

if (
j < length
&& j > (i + 2 + (hexMode? 1 : 0))
&& ch == ';'
) {
b.append(t.substring(i, j + 1)); //
incl/excl
i = j;
} else {
b.append(E[k]);
}
}