Jan Prill
2005-Dec-02 13:37 UTC
encoding-differences in mysql/ruby-bindings and mysql/native-bindings
Hi, List, after testing my current project on EdgeRails I''ve realised that the connections to mysql gets lost. This is while I''m on Windows Server 2003, ruby 1.8.2 and EdgeRails. I''ve experienced these connection losses some time ago after updating to Rails 1.0rc4 and got around it by commenting out a line containing mysql411 in mysql_adapert.rb. But this don''t seem to be the problem any longer in EdgeRails since this line isn''t present in the current mysql_adapter.rb of trunk. So I decided to give the native-mysql bindings another try. Something I gave up on the last time I''ve experienced this problem because of the difficulties that are coming with the compiling of mysql-2.7 on windows. Anyway: This time I''ve compiled my own version of mysql.so and also tried the one that comes with "Ruby on Apache". My problem now is that connection to mysql works again, but while I''m retrieving, updating or inserting records to mysql 5.0 tables with encoding of utf-8 my actions result in incorrect encodings. Accented characters and other special characters are broken because of this. The mysql/ruby-bindings didn''t have this problem. Has anyone run into this and could give me a clue what is going on here? Regards Jan Prill
Jan Prill
2005-Dec-02 14:19 UTC
Re: encoding-differences in mysql/ruby-bindings and mysql/native-bindings
Hi List, just to answer my own question: After adding encoding: utf8 (# NOT utf-8 or UTF-8) to config/database.yml the encoding-problems are gone with the wind. And guess what: Running on EdgeRails and mysql-native-bindings seems to result in a 300-400% performance increase in development mode. Most of it would be the native-bindings I guess. This is no news for the readers of rubyonrails weblog, but for me it''s a great improvement as I''ve managed to get it working for the first time on windows without the encoding-problems. Regards Jan Jan Prill wrote:> Hi, List, > > after testing my current project on EdgeRails I''ve realised that the > connections to mysql gets lost. This is while I''m on Windows Server > 2003, ruby 1.8.2 and EdgeRails. I''ve experienced these connection > losses some time ago after updating to Rails 1.0rc4 and got around it > by commenting out a line containing mysql411 in mysql_adapert.rb. But > this don''t seem to be the problem any longer in EdgeRails since this > line isn''t present in the current mysql_adapter.rb of trunk. So I > decided to give the native-mysql bindings another try. Something I > gave up on the last time I''ve experienced this problem because of the > difficulties that are coming with the compiling of mysql-2.7 on > windows. Anyway: This time I''ve compiled my own version of mysql.so > and also tried the one that comes with "Ruby on Apache". > > My problem now is that connection to mysql works again, but while I''m > retrieving, updating or inserting records to mysql 5.0 tables with > encoding of utf-8 my actions result in incorrect encodings. Accented > characters and other special characters are broken because of this. > The mysql/ruby-bindings didn''t have this problem. Has anyone run into > this and could give me a clue what is going on here? > > Regards > Jan Prill > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Julian ''Julik'' Tarkhanov
2005-Dec-02 15:15 UTC
Re: encoding-differences in mysql/ruby-bindings and mysql/native-bindings
On 2-dec-2005, at 14:37, Jan Prill wrote:> Hi, List, > > after testing my current project on EdgeRails I''ve realised that > the connections to mysql gets lost. This is while I''m on Windows > Server 2003, ruby 1.8.2 and EdgeRails. I''ve experienced these > connection losses some time ago after updating to Rails 1.0rc4 and > got around it by commenting out a line containing mysql411 in > mysql_adapert.rb. But this don''t seem to be the problem any longer > in EdgeRails since this line isn''t present in the current > mysql_adapter.rb of trunk. So I decided to give the native-mysql > bindings another try. Something I gave up on the last time I''ve > experienced this problem because of the difficulties that are > coming with the compiling of mysql-2.7 on windows. Anyway: This > time I''ve compiled my own version of mysql.so and also tried the > one that comes with "Ruby on Apache". > > My problem now is that connection to mysql works again, but while > I''m retrieving, updating or inserting records to mysql 5.0 tables > with encoding of utf-8 my actions result in incorrect encodings. > Accented characters and other special characters are broken because > of this. The mysql/ruby-bindings didn''t have this problem. Has > anyone run into this and could give me a clue what is going on here?I am running two apps on edge rails on OS X and FreeBSD, with MySQL 4.1 and everything works fine (both apps are in Russian). Are you sure you got your tables, columns et al CHARSET''ted properly? Are you sure that you have your encoding set up as utf8 in the database.yml? (no dashes?) However I use my own legacy plug-in to configure the charset. If so, it ought to be something with the 5.0 branch.
Julian ''Julik'' Tarkhanov
2005-Dec-02 15:22 UTC
Re: encoding-differences in mysql/ruby-bindings and mysql/native-bindings
On 2-dec-2005, at 15:19, Jan Prill wrote:> Hi List, > > just to answer my own question: > > After adding encoding: utf8 (# NOT utf-8 or UTF-8) to config/ > database.yml the encoding-problems are gone with the wind.So I was right on that one. Glad you got it sorted out. Actually this ought to raise an exception of MySQL can''t configure the charset, I will look at the sources.