Search code examples
phpzend-frameworkhtml-entitiesdouble-quotes

Double Quotes shown as some strange characters - PHP, HTML


If you notice the two line below, the double quotes are not the same. the first one is what i have a problem with. They are shown as strange characters like - �. But the secound line double quotes is just fine.

“this is line 1.”

and

"this is line 2."

What is the difference between the two double quotes, and how can the special characters be prevented?


Solution

  • In line 1, those quotes are sometimes called "smart quotes". They are ascii code #147 and #148.

    In line 2, those are "normal" quotes, ascii code #34.

    Because character definition beyond ascii code #127 can become somewhat arbritrary depending on the font used, I try to avoid using the smart quote characters.

    Micorosoft Word will (infamously) convert normal quotes to "smart quotes". This "feature" can be turned off in settings.