Escaping international characters

Hello,

This seems rather simple but it doesn't work as expected:

I have a string like "'école" I would like to get "école".

I tried:

@aName = CGI.escapeHTML(myString)

but it doesn't work?

(I am not doing a rails application, just a simple script)

Thanks,

Alex

···

--
Alexander Lamb
Service d'Informatique Médicale
Hôpitaux Universitaires de Genève
Alexander.J.Lamb@sim.hcuge.ch
+41 22 372 88 62
+41 79 420 79 73

Alexander Lamb wrote:

Hello,

This seems rather simple but it doesn't work as expected:

I have a string like "'école" I would like to get "école".

I tried:

@aName = CGI.escapeHTML(myString)

but it doesn't work?

(I am not doing a rails application, just a simple script)

My fear is that escapeHTML simply isn't that smart.

You might have to hand-code those cases. If it comes to that,
please share it with everyone else. Maybe it could even
find its way back into the lib.

Where is James Bond when you need him? He was always good
at escaping international characters.

Hal

Get this:

http://htmlentities.rubyforge.org/

And do this:

HTMLEntities.encode_entities("école", :basic, :named)
# => "école"

(Make sure that you are using UTF-8)

Paul.

···

On 25/07/06, Alexander Lamb <Alexander.J.Lamb@sim.hcuge.ch> wrote:

Hello,

This seems rather simple but it doesn't work as expected:

I have a string like "'école" I would like to get "&eacute;cole".

Exactly what I needed, thanks!

···

--
Alexander Lamb
Service d'Informatique Médicale
Hôpitaux Universitaires de Genève
Alexander.J.Lamb@sim.hcuge.ch
+41 22 372 88 62
+41 79 420 79 73

On Jul 25, 2006, at 9:11 AM, Paul Battley wrote:

On 25/07/06, Alexander Lamb <Alexander.J.Lamb@sim.hcuge.ch> wrote:

Hello,

This seems rather simple but it doesn't work as expected:

I have a string like "'école" I would like to get "&eacute;cole".

Get this:

http://htmlentities.rubyforge.org/

And do this:

HTMLEntities.encode_entities("école", :basic, :named)
# => "&eacute;cole"

(Make sure that you are using UTF-8)

Paul.