optimized mysqli encoding