Added tests

I don't understand the reasons behind encoding part but I think you had the order of encodings in #encode wrong so I swapped it to this

```ruby
 value.encode(Encoding::UTF_8, Encoding::ISO_8859_1, { :invalid => :replace, :replace => '-' }).force_encoding(Encoding::UTF_8)
```
With this it seems to work, the other way results in Encoding::UndefinedConversionError for UTF input.

Please double check this and feel free to change it back. Just modify test/unit/sso/apache_test.rb on line 63 accordingly in such case. Other parts should be all right. This also fixes tests broken by original PR.