Fixing record_js_error - ActionController::InvalidByteSequenceErrorFromParams

Pull request to fix the issue #368.

Don't bother you with the other "commits" I've reverted them, the changes only concern the above issue.