Solution for Deprecated function iconv_set_encoding() error while Joomla Installation in php 5.6

If you are trying to install Joomla (or other CMS) in php 5.6 environment and encounter the error : Deprecated: iconv_set_encoding()
– I’ve got a solution for you.

The error may look like following:

Deprecated: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated in joomlaroot\libraries\joomla\string\string.php on line 27

Deprecated: iconv_set_encoding(): Use of iconv.input_encoding is deprecated in joomlaroot\libraries\joomla\string\string.php on line 28

Deprecated: iconv_set_encoding(): Use of iconv.output_encoding is deprecated in joomlaroot\libraries\joomla\string\string.php on line 29

Open the file string.php in “joomlaroot\libraries\joomla\string\” directory. Go to line 27.

Now change the following lines:

if (function_exists(‘iconv’))
{
// These are settings that can be set inside code
iconv_set_encoding(“internal_encoding”, “UTF-8”);
iconv_set_encoding(“input_encoding”, “UTF-8”);
iconv_set_encoding(“output_encoding”, “UTF-8”);
}

to the following:

if (function_exists(‘iconv’) && PHP_VERSION_ID < 50600)
{
// These are settings that can be set inside code
iconv_set_encoding(“internal_encoding”, “UTF-8”);
iconv_set_encoding(“input_encoding”, “UTF-8”);
iconv_set_encoding(“output_encoding”, “UTF-8”);
}
elseif (PHP_VERSION_ID >= 50600)
{
ini_set(‘default_charset’, ‘UTF-8’);
}

This should resolve the problem and let you progress to the next level during Joomla installation.

36 Comments

  1. Daniele says:

    I’m sorry I tried to do as listed by you but it does not work. Now tell me syntax error?
    >Parse error: syntax error, unexpected ‘=’ in C:\Users\Monica\xampp\htdocs\gruppoalbatro\libraries\joomla\string\string.php on line 32

  2. Alexandra López says:

    I’ve got a solution doing this:

    Change de following lines:
    -if (function_exists(‘iconv’))
    {
    // These are settings that can be set inside code
    iconv_set_encoding(“internal_encoding”, “UTF-8?);
    iconv_set_encoding(“input_encoding”, “UTF-8?);
    iconv_set_encoding(“output_encoding”, “UTF-8?);
    }

    to the following:
    if (PHP_VERSION_ID < 50600) {
    iconv_set_encoding('input_encoding', 'UTF-8');
    iconv_set_encoding('output_encoding', 'UTF-8');
    iconv_set_encoding('internal_encoding', 'UTF-8');
    } else {
    ini_set('default_charset', 'UTF-8');
    }

  3. mule says:

    Thanks it work on me!!!

  4. Kwesi Acquah-Dadzie says:

    great post!!!! Solved my problem…

    THANK U!!

  5. Nestor Fontalvo says:

    Thanks…solution totally

  6. Teddy says:

    Worked like a charm

  7. laentyvn says:

    Or change code by this
    // Same for iconv
    if (function_exists(‘iconv’))
    {
    // These are settings that can be set inside code
    if (version_compare(PHP_VERSION, ‘5.6’, ‘>=’))
    {
    @ini_set(‘default_charset’, ‘UTF-8’);
    }
    else
    {
    iconv_set_encoding(“internal_encoding”, “UTF-8”);
    iconv_set_encoding(“input_encoding”, “UTF-8”);
    iconv_set_encoding(“output_encoding”, “UTF-8”);
    }
    }

  8. ALEXANDRA LÓPEZ thank you !!!!!

  9. aditya says:

    Thanks a lot…….. its works for me greats

  10. Excelent! It works fine!
    Thanks

  11. MARK says:

    am very much appreciative!!!it worked so well….

  12. bagoes says:

    thankz alexander lopez this work 🙂

  13. saif says:

    o my god! thanks a lot!

  14. Alistair says:

    Thank you very much! This was a real issue for me and your help is really appreciated.

  15. Zohaib says:

    Thank you very much, my problem is solve

    Regards,
    Zohaib

  16. OSCAR says:

    ALEXANDRA LOPEZ. YOU ARE THE BEST. THANKS A LOT

  17. Romer Ariel Romero Isnado says:

    Oh muchas gracias…

  18. Tony Hill says:

    Still Solving my problem …..Nice job Alex

  19. Patricia says:

    Aplique las soluciones.
    Todo bien los 3 pasos hasta que comienza a generar la base de datos. Ahí se queda colgada tratando de generar y no lo hace.
    Que podrá ser??? Agradecería que me ayudaran, hace días que estoy con este problema.
    Gracias

  20. Grigoris Papadopoulos says:

    Great solution! Thanks a lot!

  21. Msa Software says:

    Agradecido por la informacion. Me aparece ahora el siguente mensaje. Fatal error: Call to undefined function simplexml_load_file() in /var/www/html/joomla/installation/includes/application.php on line 301
    Lo buscare en google. Gracias.

  22. Oscar Satizabal says:

    Thank you ALEXANDRA LÓPEZ

  23. Alejandro says:

    great, it worked perfect.

  24. Sergey says:

    It’s work. Thanks!

  25. Wisnu Prabowo says:

    It work!! Thanks Lopez

  26. Romeo says:

    Thanks Alot. Works

  27. Ash says:

    Cheers mates got it working!!

  28. Larry Mesa says:

    cual seria el código completo, la verdad no tengo esas lineas y estoy pegado no he podido avanzar, me pueden ayudar con todo el código completo.

    Tengo solo string y dentro de este string nuevamente y no string.php, por favor ayuda

Leave a Comment