@PavloKovalyov solution for regexp encoding issue