Fix regexp encoding compatibility