From: Alex Gutteridge Date: 2010-11-25T21:14:41+09:00 Subject: Re: SQLite3/Sinatra not returning results On Thu, 25 Nov 2010 20:35:13 +0900, "zimbatm ..." wrote: > Hi Alex, > > the problem is probably related to the different ruby versions since > many things have changed between 1.8.7 and 1.9.2. Try installing ruby > 1.9.2 with RVM ( http://rvm.beginrescueend.com ) on your development > machine and see if you have the same problem. > > $ gem install rvm > $ rvm-install > $ rvm install ruby-1.9.2 > $ rvm use --default ruby-1.9.2 > > Fix your .profile, make sure you don't export GEM_HOME in the > environment and that ~/.gemrc > doesn't list "gem: --user-install". Othewise, it works pretty well. > > RVM is also able to switch ruby versions depending on the project you're > working on, which is handy if you have different projects which require > different ruby versions. > > Cheers, > zimbatm Thanks. It turned out to be an String encoding issue. Sinatra was returning an "ASCII-8BIT" encoded string, while the SQLite3 db is "US-ASCII" encoded. Manually setting the Sinatra string encoding to "US-ASCII" got the DB query to match. -- Alex Gutteridge