In both ISO-8859-1 and ISO-8859-15, character number 146 is the control character MW
(Message Waiting) from range C1 .
SGML refers to ISO 8859-1 (consider the space between ISO and 8859-1, which is not a hyphen, as in the character sets you use). It does not allow to control characters, but three (here: SGML in HTML ):
Only three control characters are allowed in the HTML document character set: Horizontal Tab, carriage return, and line feed (code positions 9, 13, and 10).
So you missed the illegal character. There is no SGML / HTML object for which you can replace it.
I suggest you check the input that is included in your application so that it does not allow you to control characters. If you think that these characters originally represented a useful thing, such as a letter that can actually be read (for example, a non-control character), it is likely that when processing data, encoding is interrupted at some point.
From the information given in your question, it is difficult to say where, since you only specify the input encoding and the encoding of the filed database - but the two do not match anymore (which should not lead to the problem that you are asking about, but this may cause others Problems). Next to these two places there is also a database client connection encoding (vague in your question), output encoding (vague in your question) and response content encoding (vague in your question).
It might seem that you will change your general encoding to UTF-8 to support a wider range of characters, but this is really possible.
Edit: The part above is a somewhat rigorous look. It occurred to me that the input you receive is not ISO-8859-1 (5), but something else, such as the Windows codepage. I would say Windows-1252 (cp1252) & shy; Wikipedia Compared to the C1 range of ISO-8859-1 (128-159), it has several uncontrollable characters.
The Wikipedia page also notes that most browsers view ISO-8859-1 as Windows-1252 / CP1252 / CP-1252. The PHP htmlentities()
function cannot handle these characters, the translation table for HTML objects does not apply to code pages (PHP 5.3, not tested on 5.4). You need to create your own translation table and use it with strtr
to replace characters not available in ISO 8859-15 for windows-1252:
$cp1252HTML401Entities = array( "\x80" => '€',
If you want to be even more secure, you can save named objects and just select numeric ones that should also work in very old browsers:
$cp1252HTMLNumericEntities = array( "\x80" => '€',
Hopefully this will become more useful now. See also the Wikipedia page linked above for some characters that are in windows-1242 and ISO 8859-15, but at different points. You should probably consider using UTF-8 on your website.