php remove/identify this symbol �

后端 未结 8 1712
无人及你
无人及你 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:32

    A really vague question. Somehow, check your website's encoding, your database's data encoding and so.

    EDIT: It IS an answer because the flaw is a mismatch between the DB data encoding (probably on utf-8) and the webapp encoding (probably on iso-8859-1). So, the solution goes by either:

    1.) backup and Wipe out the DB AND THEN load it with the proper encoding 2.) change the webapp's encoding, so the chars are properly displayed.

    Regards,

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

    It means a character that isn't available in the character set of the current font. You'll need to encode it with an HTML entity, once you've found where it's coming from.

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

    That character means there is a codepoint that your browser does not know how to display. Somewhere you're setting a character value to something outside the normal printable character range, and your browser is telling you by displaying the standard 'unknown' character.

    The only way to tackle the problem is to find the bug that put the invalid character into your string in the first place.

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

    What are you talking about? Where have you seen this? If its on the rendered page on browser, then you might have saved the file with an improper encoding. Use UTF or unicode encoding while saving the page/source file.

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

    The character is the REPLACEMENT CHARACTER (U+FFFD). It is used when there was an error within an UTF code:

    FFFD � REPLACEMENT CHARACTER

    • used to replace an incoming character whose value is unknown or unrepresentable in Unicode

    In most cases it means that some data is interpreted with an UTF encoding while the data is not encoded with that encoding but a different one.

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

    You can look into iconv() and mb_* functions if you're just trying to sanitize the data.

    The most likely cause as observed elsewhere is that you've got a problem with character encodings. PHP is not very good at dealing with character encodings until version 6 (dealing with byte arrays and leaving encoding issues more or less up to the developer to deal with).

    Make sure you're displaying the page in the same character encoding as your database, and make sure that you convert all user input into that same character encoding (iconv() and mb_detect_encoding() will help) before sticking it in the database.

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