iso-8859-1 no effect in browser

hi folks!

I want to use characters with accent, like: é, ç, ã, ô. Then I changed from UTF-8 to iso-8859-1, so I can use é direct, instead of é

<html> <head>   <meta http-equiv="content-type" content="text/ html;charset=iso-8859-1" />

The strange is that when I go in View -> Codification, it is marked Unicode (UTF-8). :frowning: But this is not the worst. The browser doesn't change from special chars to its meaning.

validates_format_of :email,         :with => %r{[_a-z0-9-][_a-z0-9-]*@[_a-z0-9-][_a-z0-9-]*\.[_a-z0-9-] [_a-z0-9-]*}i,         :message => 'est&aacute; incorreto'

It display Email est&aacute; incorreto. I want Email está incorreto.

Help meee! =D

Have you tested with utf-8? That should have worked.

Fidel.

tivrfoa wrote:

I want to use characters with accent, like: é, ç, ã, ô. Then I changed from UTF-8 to iso-8859-1, so I can use é direct, instead of &eacute;

That's not what the charset= is for. You should use the correct entities if at all possible, and neither your editor...

The strange is that when I go in View -> Codification, it is marked Unicode (UTF-8). :frowning:

...nor Ruby...

validates_format_of :email,         :with => %r{[_a-z0-9-][_a-z0-9-]*@[_a-z0-9-][_a-z0-9-]*\.[_a-z0-9-] [_a-z0-9-]*}i,         :message => 'est&aacute; incorreto'

...are bothering to read that directive. They are still defaulting to utf-8, which is good enough for 99.999% of all programming.

Further, both utf-8 and iso-8859-1 share many of the same Latin-1 code points, including é. Utf-8 merely gives the additional abilities to build the é out of an e and a modifying accent character, and the ability to read and write every other glyph in the world.

You would only use iso-8859-1 if you had a database with known iso-8859-1 strings, AND if you did not want to simply Iconv them to UTF-8 before pushing them into your HTML.

tks! it didn't work in utf-8. if I use está (without the special character), it display an interrogation symbol (?)

Could someone try to use this => :message => 'est&aacute; incorreto' in some validation to see if it works?

How can I display "está"?

tks

I create almost only spanish applications, all with Ñ ñ, á é and so on, and use ONLY UTF-8.

The meta directive <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> between the head tags does all the magic.

Regards.

Franco Catena.

thansk Franco.

it works on the view, but not work in the model (at least here) did you try to add a message in some model with accent?

Yes, i use it a lot, but in this form:

record.errors.add attr, :invalid # or any other

And then in the config/locales/es.yml

es:   activerecord:     errors:       messages:         invalid: "no es válido"

      # Custom for one model       models:         somemoder:           attributes:             someattribute:               invalid: "es inválido"

I never use it in the direct form, always with the I18n package. If you want a complete example see http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale.

Regards.

Franco Catena.

thanks folks.

I solved the problem using a different text editor. Now I'm using <a href="Plasma Code – Deportes, Negocios, Tecnología. It's an amazing editor, but only available for Windows. The problem was the encode of the files.