Unescape html text

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unescape html text

Brian Murphy-Dye-3
Is there an existing method that is the opposite of  
String>>encodeForHTTP, e.g., converting
  'a b' into 'a b'?

#unescapePercents takes care of converting the percent signs;
  'a%26b' unescapePercents => 'a&b'
but can't find anything for the "special" escape sequences.

Brian.

Reply | Threaded
Open this post in threaded view
|

Re: Unescape html text

Alexandre Jasmin
URL Encoding ('a%20b') and HTML Character entities 'a b' are two
completely different things.


You may want to install network-HTML from SqueakMap and take a look at
#replaceHtmlCharRefs in class String.

  is unicode 160 (Non-breaking space). If you need the normal space
character you could also do:
replaceAll: (Character value: 160) with: (Character space)



Le mardi 22 mai 2007 à 18:12 -0600, Brian Murphy-Dye a écrit :

> Is there an existing method that is the opposite of  
> String>>encodeForHTTP, e.g., converting
>   'a b' into 'a b'?
>
> #unescapePercents takes care of converting the percent signs;
>   'a%26b' unescapePercents => 'a&b'
> but can't find anything for the "special" escape sequences.
>
> Brian.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Unescape html text

Brian Murphy-Dye-3
Perfect, #replaceHtmlCharRefs is just what I was looking for. Thanks,  
Brian.


On May 23, 2007, at 12:19 AM, Alexandre Jasmin wrote:

> URL Encoding ('a%20b') and HTML Character entities 'a b' are two
> completely different things.
>
>
> You may want to install network-HTML from SqueakMap and take a look at
> #replaceHtmlCharRefs in class String.
>
>   is unicode 160 (Non-breaking space). If you need the normal  
> space
> character you could also do:
> replaceAll: (Character value: 160) with: (Character space)
>
>
>
> Le mardi 22 mai 2007 à 18:12 -0600, Brian Murphy-Dye a écrit :
>> Is there an existing method that is the opposite of
>> String>>encodeForHTTP, e.g., converting
>>   'a b' into 'a b'?
>>
>> #unescapePercents takes care of converting the percent signs;
>>   'a%26b' unescapePercents => 'a&b'
>> but can't find anything for the "special" escape sequences.
>>
>> Brian.
>>
>>
>
>