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

Antony
  • 2,748
  • 22
  • 21
  • 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. – Magnus Eriksson Feb 02 '18 at 14:12
  • You should also check your php.ini that XML extension is actually loaded. You can create info.php file with ` – dkasipovic Feb 02 '18 at 14:15

2 Answers2

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.

jeroen
  • 88,615
  • 21
  • 107
  • 128
  • 1
    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. – Antony Feb 02 '18 at 14:16
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.

Ben Harris
  • 537
  • 5
  • 10
  • I get `php7.0-mbstring is already the newest version (7.0.27-1+ubuntu17.10.1+deb.sury.org+1).` :( – Antony Feb 02 '18 at 14:14
  • Try @jeroen's answer. Otherwise, you should be able to use the functions that are included in `mbstring` for all your unicode needs. – Ben Harris Feb 02 '18 at 14:16