incompatible character encodings ruby

I'm getting the following error with my Ruby 1.9

I tried using (as some resources suggested)

string.force_encoding('utf-8')

But it didn't help!

Any ideas how to resolve this? Is there a way to eliminate such characters before saving to DB? or is a there a way to make them show?

For example, when I want to print:

Opowieść o kulcie przemocy

I get:

Opowie?? o kulcie przemocy


ANSWERS:


I make it work using this first line of code:

# encoding: UTF-8

string = "Opowieść o kulcie przemocy"
p string.force_encoding('utf-8')

when i write to the DB , I use the encode and not the force_encoding , for example:

conn.exec(sql.encode("UTF-8"))

where sql is the statement containing the text that needs to be encoded



 MORE:


 ? Ruby windows-1250 encoding
 ? String encoding issue in Ruby
 ? Ruby: File.read Error encoding:"UTF-8"
 ? String Encoding in Ruby
 ? Ruby compatibility error encoding
 ? What's the behavior the browser encoding URL?
 ? ERROR: when installing electron?
 ? Node writeFileSync encoding options for images
 ? UTF8 characters come out as windows-1252, ExpressJS running on Electron
 ? RSA encrypt/decrypt failing in my own implementation in python