This works: $csv = " b'xd0x9exd0xb4xd0xbdxd0xb0xd0xbaxd0xbe xd0xbexd0xb1xd0xb8xd0xb4xd0xbdxd0xbe xd0xb1xd1x83xd0xb4xd0xb5xd1x82 xd0xbfxd0xbexd1x82xd1x80xd0xb0xd1x82xd0xb8xd1x82xd1x8c xd0xbdxd0xb0 xd0xb4xd0xb5xd0xbbxd0xb0 xd0xb2xd1x80xd0xb5xd0xbcxd1x8f, xd0xbaxd0xbexd1x82xd0xbexd1x80xd0xbexd0xb5 xd0xbcxd0xbexd0xb3xd0xbbxd0xb8 xd0xb1xd1x8b xd0xbfxd1x80xd0xbexd0xb2xd0xb5xd1x81xd1x82xd0xb8 xd0xb1xd0xbexd0xbbxd0xb5xd0xb5 xd0xbfxd0xbbxd0xbexd0xb4xd0xbexd1x82xd0xb2xd0xbexd1x80xd0xbdxd0xbe.'"; $csv = mb_convert_encoding($csv,'UTF-8'); While this returns unconverted string: $o = shell_exec('python3.6 /var/www/html/main.py'.'normal'); $contents = mb_convert_encoding($o,'UTF-8'); echo $contents Python script returns same string.…