[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

localization

Josselin

6/15/2006 5:53:00 AM

I use successfully Thomas Fuchs' Localization plugin...

strings are written in /lang/fr_FR.rf file like :
Localization.define('fr_FR') do |l|
....
l.store 'Log out', 'Déconnexion'
....

but when displayed in the Browser (Safari for testing..)
I get the non UTF8 character set..

Déconnexion

to get the correct display , I have to modify Safari pref : default
encoding UTF8

why Safari doesn't recognize automatically the encoding ? shoudl I add
anything in my .rb view files ?

joss

3 Answers

f.svehla

6/18/2006 9:56:00 AM

0

> but when displayed in the Browser (Safari for testing..)
> I get the non UTF8 character set..
>
> Déconnexion

You need to set the content-encoding in a HTTP header.
Put this im your application.rb:

before_filter :set_charset

def set_charset
ActiveRecord::Base.connection.execute("SET names 'UTF8'")

@headers["Content-Type"] ||= "text/html; charset=utf-8"
end

>
> to get the correct display , I have to modify Safari pref : default
> encoding UTF8
>
>
> why Safari doesn't recognize automatically the encoding ? shoudl I add
> anything in my .rb view files ?

It is technically impossible to guess the encoding correctly.

f.svehla

6/18/2006 9:56:00 AM

0

> but when displayed in the Browser (Safari for testing..)
> I get the non UTF8 character set..
>
> Déconnexion

You need to set the content-encoding in a HTTP header.
Put this im your application.rb:

before_filter :set_charset

def set_charset
ActiveRecord::Base.connection.execute("SET names 'UTF8'")

@headers["Content-Type"] ||= "text/html; charset=utf-8"
end

>
> to get the correct display , I have to modify Safari pref : default
> encoding UTF8
>
>
> why Safari doesn't recognize automatically the encoding ? shoudl I add
> anything in my .rb view files ?

It is technically impossible to guess the encoding correctly.

Gene Tani

6/19/2006 2:27:00 AM

0


f.svehla@gmail.com wrote:
> It is technically impossible to guess the encoding correctly.

true, but Byte order Marks make life easier,

http://www.voidspace.org.uk/python/articles/guessing_enco...