2

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??

2
  • Can you update your question to include your actual issue? Linking to another post and say: "I have the same problem" isn't good enough. If that post would, for what ever reason, get deleted, this question wouldn't make any sense for future visitors. Commented Feb 2, 2018 at 14:12
  • You should also check your php.ini that XML extension is actually loaded. You can create info.php file with <?php phpinfo(); content and open it to see if the XML is loaded at all. Commented Feb 2, 2018 at 14:15

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Massive thanks apt-get install php7.1-xml fixed it - I will make this the answer and good spot. I had assumed the 7.0 worked for all 7 when it clearly didnt.
0

Try installing the mbstring extension.

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

2 Comments

I get php7.0-mbstring is already the newest version (7.0.27-1+ubuntu17.10.1+deb.sury.org+1). :(
Try @jeroen's answer. Otherwise, you should be able to use the functions that are included in mbstring for all your unicode needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.