Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End problem with str_replace on string from mysql

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #202666
    bearhead
    Participant

    I’m trying to use this php to replace characters in a text string I’ve taken from a mysql database:

    str_replace(array('“', '”', '’', '®', '—'), array('"', '"', "'", '®', '-'), $row{'description'});

    Instead of seeing the characters I’m trying to use as replacements, I’m just seeing missing character symbols when the page renders in browser.

    If I run that same str_replace code on a string not taken from mysql, it works as expected.

    The “description” field in mysql is set to use character set: utf8

    what am I missing?

    #202692
    ovi
    Participant

    Make sure the PHP file where you use this function is encoded as UTF-8.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.