PHP 7无法运行utf8函数

I am hitting the same problem as reported here: utf8_(en|de)code removed from php7? but nothing from any of the ideas have worked.

I've just run:

apt-get upgrade followed by apt-get install php7.0-xmlrpc php7.0-xml and Ubuntu tells me *both is already the newest version.

If I run my simple test script:

echo function_exists('utf8_encode') ? 'Good' : 'Bad';

(Equally if I replace utf8_encode with simplexml_load_file this too returns Bad)

I am constantly seeing "Bad". I'm not running from apache (although it is installed on the server) I am running direct from the command line.

I've also done a reboot and still no progress. PHP Version reports:

7.1.13-1+ubuntu17.10.1+deb.sury.org+1

Which is wierd considering I thought this function was still in at this point?

So my question is how can I get utf8_encode/decode working??

It looks like you are installing the wrong version of the xml extension: You seem to be installing the version for php 7.0 and you are using php 7.1.

Try looking for - and installing - php7.1-xmlrpc and php7.1-xml.

Try installing the mbstring extension.

Unicode features were moved into the mbstring extension. Check out the documentation for all of the available functions there.