I need to replace Microsoft Word's version of single and double quotations marks (“ ” ‘ ’
) with regular quotes (' and ") due to an encoding issue in my application. I do not need them to be HTML entities and I cannot change my database schema.
I have two options: to use either a regular expression or an associated array.
Is there a better way to do this?
I have found an answer to this question. You need just one line of code using iconv()
function in php:
// replace Microsoft Word version of single and double quotations marks (“ ” ‘ ’) with regular quotes (' and ")
$output = iconv('UTF-8', 'ASCII//TRANSLIT', $input);