[TxMt] Convert to named entity: error decoding £

Timothy Bates timothy.c.bates at gmail.com
Sat Nov 12 14:15:48 UTC 2005


> Then what if you wanted to convert a & to '&'?
>
> -- Sune.

Hmm.  "&" doesn't match any numeric or named entity, so ...

if the selection is "&" and the user chooses the command "convert to  
named entity" it should still be upconverted to &

A simple rule would be

if ( regexp("&.{3,4};", str) ) {
	//string looks like a valid numeric entity
	convertNumericToNamedEntity(str);
else
	//string looks like plain text
	convertCharToNamedEntity(str);
}


On 12/11/2005, at 9:04 AM, Sune Foldager wrote:
> On 11/11/2005, at 22.46, Timothy Bates wrote:
>
>> Merci for pointing out how it works, but I guess I can't see the  
>> value in a
>> converter which can't see that  it has a numeric as input and do  
>> the right
>> thing. Amp is just wrong as an output.
>
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list