php remove/identify this symbol �

后端 未结 8 1713
无人及你
无人及你 2020-12-11 22:26

EDIT:

Ok I have some data (A ton of data) being pulled from a MySQL DB Table, nothing special about how the data is entered. When parsing the data and re-displaying

相关标签:
8条回答
  • 2020-12-11 22:58

    This is a common problem when pasting text from microsoft office products to html, or into a database. The largest offenders seem to be the emdash(as you found) and smart quotes. One solution I have found when users insist upon using a text editor that is non-compliant like that is to have them paste it into something like notepad first, to strip the proprietary symbols.

    Obviously the best solution is to simply not use word for textual data that is intended for web display.

    Added just to provide some info to future readers.

    Regards, Jc

    0 讨论(0)
  • 2020-12-11 22:59

    Why not try a regex in javascript against what Gumbo identified as "... character � ... the REPLACEMENT CHARACTER (U+FFFD)" after rendering the webpage - this way you will not have to mess with the DB (which you seem very reluctant to do) and whatever minor performance penalty is offloaded to the client side.

    0 讨论(0)
提交回复
热议问题