From: Iain Barnett Date: 2010-12-17T02:08:01+09:00 Subject: Re: do your bit for my mental health - how to find the difference between two strings? Thanks for all the responses, though I was looking for the difference between two seemingly identical string, I will keep the levenshtein distance algorithm around for another future project :) On 14 Dec 2010, at 18:42, Brian Candler wrote: > > service = params[:service] > service.replace('servicename') # <<<< > STDERR.puts service.inspect, service.encoding > mymethod( service ) > > Try running this with the marked line present, and with that line > commented out. this bore some info. I'm running Ruby 1.92 (sorry, I should have mentioned that) with Sinatra 1.1.0. With the replace function the encoding is US-ASCII, or UTF-8 if I set the `# encoding: utf-8` at the top of the file. Without the replace function the encoding is ASCII-8BIT. I've been searching around for how to make all this work now I know this, and poking around in the Sinatra and Rack source, but haven't found a (working) answer yet. I'll post it when I do. Thanks very much for the help. Regards, Iain