Greetings Railers. I have some problems to get my UTF-8 site to work correctly. Works fine under webrick and just after the reboot of lighttpd on production. But on the next visit to the site, text fetched from the DB containing ÅÄÖ is replaced på "?"''s :( Done so far: *DB (MYSQL) * charset set to UTF-8 on all tables. * controllers/application.rb* before_filter :set_charset def set_charset @headers["Content-Type"] = "text/html; charset=UTF-8" end suppress(ActiveRecord::StatementInvalid) do ActiveRecord::Base.connection.execute ''SET NAMES UTF8'' end Could this be that the caching of the pages are non-utf8?? Solution anyone? Regards // Jonas Montonen _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
jonte wrote:> Could this be that the caching of the pages are non-utf8?? > Solution anyone?Appearantly the webserver doesn''t sent the correct content-type header. Try to set it in the HTML source with a meta tag: <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> -- Posted via http://www.ruby-forum.com/.
Andreas Schwarz wrote:> jonte wrote: > >> Could this be that the caching of the pages are non-utf8?? >> Solution anyone? >> > > Appearantly the webserver doesn''t sent the correct content-type header. > Try to set it in the HTML source with a meta tag: > > <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> > >This does not help... The page is already sent in UTF-8 (Verified in Firefox, page info) The problem is that some of the text (not hardcoded into the view) that are fecthed from the DB are messed up. Works after a restart of the server... but returns to ???? instead of ÅÄÖ after a while. // Jonas _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Julian ''Julik'' Tarkhanov
2005-Nov-16 16:02 UTC
Re: Re: UTF-8 problems... caching messing stuff up?
On 16-nov-2005, at 13:19, Jonas Montonen wrote:> Andreas Schwarz wrote: >> jonte wrote: >>> Could this be that the caching of the pages are non-utf8?? >>> Solution anyone? >> Appearantly the webserver doesn''t sent the correct content-type >> header. Try to set it in the HTML source with a meta tag: > This does not help... The page is already sent in UTF-8 (Verified > in Firefox, page info) > > The problem is that some of the text (not hardcoded into the view) > that are fecthed from the DB are messed up. > Works after a restart of the server... but returns to ???? instead > of ÅÄÖ after a while.You need to call "SET NAMES whatever" on every request. I recently wrote a little plugin which triggers all the needed hacks for Unicode for me. -- Julian "Julik" Tarkhanov _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Wed, Nov 16, 2005 at 01:07:01PM +0100, Andreas Schwarz wrote:> jonte wrote: > > Could this be that the caching of the pages are non-utf8?? > > Solution anyone?when the cache-files are written, it depends on the output of your webserver - e.g. i had to put --- snip --- AddDefaultCharset UTF-8 --- snap --- (beforehand the default output was iso8859-1) into apache-conf. greetings rene
Rene Paulokat wrote:> On Wed, Nov 16, 2005 at 01:07:01PM +0100, Andreas Schwarz wrote: > >> jonte wrote: >> >>> Could this be that the caching of the pages are non-utf8?? >>> Solution anyone? >>> > > > when the cache-files are written, it depends on the output of your webserver - > > e.g. i had to put > --- snip --- > AddDefaultCharset UTF-8 > --- snap --- > (beforehand the default output was iso8859-1) > into apache-conf. > > greetings > > rene > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >I finally managed to locate the default charset option in Webmin (Hosted at http://www.textdrive.com) (Apache Server/Virtual Server XYZ/Languages/Character set for documents*)*. When I set that one to UTF-8 the caching seems to save my precious ÅÄÖ''s ;) Let''s see if it stays that way... Thanks you all for the inputs!! Regards Jonas Montonen, http://bytadvd.se _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Jonas Montonen wrote:> Rene Paulokat wrote: >> On Wed, Nov 16, 2005 at 01:07:01PM +0100, Andreas Schwarz wrote: >> >>> jonte wrote: >>> >>>> Could this be that the caching of the pages are non-utf8?? >>>> Solution anyone? >>>> >> >> >> when the cache-files are written, it depends on the output of your webserver - >> >> e.g. i had to put >> --- snip --- >> AddDefaultCharset UTF-8 >> --- snap --- >> (beforehand the default output was iso8859-1) >> into apache-conf. >> >> greetings >> >> rene >> >> >> >> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > I finally managed to locate the default charset option in Webmin > (Hosted at http://www.textdrive.com) > (Apache Server/Virtual Server XYZ/Languages/Character set for > documents*)*. > When I set that one to UTF-8 the caching seems to save my precious > ÅÄÖ''s ;) > > Let''s see if it stays that way... > > Thanks you all for the inputs!! > Regards Jonas Montonen, http://bytadvd.se > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >NOOOOO!! It''s back!! Well well... back to the drawing board. Using the plugin as well as UTF-8 as defaullt charset, still no party :( // Jonas _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails