hello! I have a problem when I want to display data in Unicode from database. I read <a href="http://ruphus.com/blog/2005/06/23/getting-unicode-mysql-and-rails-to-cooperate/">this tutorial</a> but I still have problem with non-English characters. I don''t have any other idea what I should do. Did you meet with similat problem? Have you got any idea? Thanks in advance. -- Posted via http://www.ruby-forum.com/.
Hi, Agnieszka, have you made sure that you''ve got and encoding: utf8 directive in your database.yaml config file? Cheers, Jan On 7/24/06, Agnieszka Piekarska <piekarka3@interia.pl> wrote:> > hello! I have a problem when I want to display data in Unicode from > database. I read <a > href=" > http://ruphus.com/blog/2005/06/23/getting-unicode-mysql-and-rails-to-cooperate/ > ">this > tutorial</a> but I still have problem with non-English characters. I > don''t have any other idea what I should do. Did you meet with similat > problem? Have you got any idea? Thanks in advance. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060724/0f16f5a7/attachment.html
hello! Yes, I''m sure. My database.yml file looks like: development: adapter: mysql database: *** encoding: utf8 username: *** password: *** host: *** port: *** etc... but is it possible that problem lies in fact that my database in on Unix environment but I work on Windows. May this connection cause a special probelem? I look for special coding, parameters in Ruby source but I find nothing. -- Posted via http://www.ruby-forum.com/.
Are you testing the application in webrick? If it''s load webrick with the option -c utf-8 (ruby script/server -c utf-8) Another thing that you can try is in your templates put the next: <HEAD> .... <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> .... </HEAD> it''s redundant(theoretically), but in some cases it''s ok. Regards -- View this message in context: http://www.nabble.com/RoR-%2B-MySQL-%2B-Unicode-tf1991783.html#a5487770 Sent from the RubyOnRails Users forum at Nabble.com.
Hi, just another guess: Have you installed the mysql gem on your windows box? gem install mysql Cheers, Jan On 7/25/06, Agnieszka Piekarska <piekarka3@interia.pl> wrote:> > hello! > Yes, I''m sure. My database.yml file looks like: > > development: > adapter: mysql > database: *** > encoding: utf8 > username: *** > password: *** > host: *** > port: *** > > etc... > but is it possible that problem lies in fact that my database in on Unix > environment but I work on Windows. May this connection cause a special > probelem? > I look for special coding, parameters in Ruby source but I find nothing. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060725/792a7a92/attachment-0001.html
Thanks for advice! ... but my application doesn''t display non-English characters. I installed mysql gem and try charset iso-8859-1. Nothing .... I use text_field_with_auto_complete and there I display data from database. May it cause problem? And when application display data from database method find(:all) is executed? I decoded data in database as utf-8 and I read data in utf-8 coding. Are used special codings from reading from database to display in application? Thanks. -- Posted via http://www.ruby-forum.com/.
I had similar problems, and after trying everything... I noticed that the problem was my database client... I mean, I used the windows "console" to execute the mysql client for loading the data and special characters displayed a ''?'' on my browser, but when I used a rake task to load data, special characters were displayed correctly. I don''t know why... but I worked for me..... I hope it helps you.... On 7/26/06, Agnieszka Piekarska <piekarka3@interia.pl> wrote:> > Thanks for advice! > ... but my application doesn''t display non-English characters. I > installed mysql gem and try charset iso-8859-1. Nothing .... > I use text_field_with_auto_complete and there I display data from > database. May it cause problem? And when application display data from > database method find(:all) is executed? I decoded data in database as > utf-8 and I read data in utf-8 coding. > Are used special codings from reading from database to display in > application? > Thanks. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060726/ed95d36a/attachment.html
Try using an encoding of chaset uft-8, that may work. As long as your database is set to work with utf-8 and you also have this set in your database yml file this should (theoretically) work. - Sarah On 7/26/06, Agnieszka Piekarska <piekarka3@interia.pl> wrote:> > Thanks for advice! > ... but my application doesn''t display non-English characters. I > installed mysql gem and try charset iso-8859-1. Nothing .... > I use text_field_with_auto_complete and there I display data from > database. May it cause problem? And when application display data from > database method find(:all) is executed? I decoded data in database as > utf-8 and I read data in utf-8 coding. > Are used special codings from reading from database to display in > application? > Thanks. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- "A defensive war against terrorism will ensure terrorism." - Mark Steyn -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060726/dcc58d72/attachment.html