Fix localeEncoding() in lib/rts.js

I don't know how important localeEncoding() is, but it is apparently broken.