Henrik --- wrote in post #976928:
> Ideally, you shouldn't have HTML entities in the database. If you need
> them
> in your HTML (and you don't, if you set an explicit encoding, except for
> things like &<>) then you should add them outside the database.
>
> If you do have "" stored in the database, not as an entity, I believe
> MySQL's "LIKE" will be accent-insensitive by default, unless you use
> "COLLATE utf8_bin" (google for details).
>
> Note that if you use "sub", you will only replace the first occurrence
> in
> the string. You probably want "gsub".
>
> And if you do something like "blh".sub("", "&eacute;") and it doesn't
> replace the "", the issue could be how the "" is represented. In UTF-8,
> accented characters can be represented either composed as a single glyph
> ("latin small letter e with acute") or decomposed as two glyphs: "latin
> small letter e" + "combining acute accent". So if your string contains
> the
> first type of  and your sub/gsub tries to replace the other type, it
> won't
> work. You can normalize the string to ensure everything is composed or
> decomposed, but it would be better not to have entities in the database.

Ok I will take your advise and remove the html entities from the 
database.
The reason I put them in was because even with explicit encoding I was 
not getting the characters to show properly. I was getting a black 
triangle with a question mark.

Could you assist me on how to encode the web page so that it shows the 
accents. I thought you just use UTF-8?

Thanks for your help. I really appreciate it.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups 
"rails-i18n" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-i18n?hl=en.

Reply via email to