(Maint) Check for `encode` when using `encode`

The check used to determine if the system supported changing the
encoding of a string was looking for `force_encoding` but actually
calling `encode`. Although not currently a problem since both methods
are available at the same time, checking for the method actually used is
safer.