holman/play — Issue #100: fix for utf8 compatibility error issue
Author: vedantk
Created: 2012-02-26 23:49:48+00:00
State: open

When I ran bin/play index, I got this error;

```/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.1.1/lib/active_record/connection_adapters/mysql2_adapter.rb:303:in `gsub': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)```

So I went into lib/play/library.rb and forced utf-8 encoding;

```@@ -57,6 +59,9 @@ module Play
# Returns the imported (or found) Song.
def self.import_song(path)
artist_name,title,album_name = fs_get_artist_and_title_and_album(path)
+ artist_name = artist_name.force_encoding('UTF-8')
+ title = title.force_encoding('UTF-8')
+ album_name = album_name.force_encoding('UTF-8')
artist = Artist.find_or_create_by_name(artist_name)
song = Song.where(:path => path).first```

This fixed everything :-). YMMV, of course.