Iso-8859-1 no effect in browser


#1

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 é

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á incorreto’

It display Email está incorreto.
I want Email está incorreto.

Help meee! =D


#2

On Tue, May 26, 2009 at 5:39 AM, tivrfoa removed_email_address@domain.invalid
wrote:

It display Email está incorreto.
I want Email está incorreto.

Help meee! =D

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

Fidel.


#3

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 é

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á 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.


Phlip
http://twitter.com/Pen_Bird


#4

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á incorreto’
in some validation to see if it works?

How can I display “está”?

tks


#5

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

The meta directive between the head tags does all the magic.

Regards.

Franco C…


#6

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?


#7

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 C…


#8

thanks folks.

I solved the problem using a different text editor. Now I’m using RoRED. It’s an amazing editor, but
only available for Windows.
The problem was the encode of the files.