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 L.
Service d’Informatique Médicale
Hôpitaux Universitaires de Genève
[email protected]
+41 22 372 88 62
+41 79 420 79 73

Alexander L. wrote:

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 B. when you need him? He was always good
at escaping international characters.

Hal

On 25/07/06, Alexander L. [email protected] 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”.

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.

Exactly what I needed, thanks!

Alexander L.
Service d’Informatique Médicale
Hôpitaux Universitaires de Genève
[email protected]
+41 22 372 88 62
+41 79 420 79 73