1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-30 19:00:10 +02:00

Give warnings when attempting to use encoding iconv doesn't support.

Previously, attempting to set %Core.Encoding to an encoding iconv didn't
know about would result in a silent failure, with the return of the
boolean false. Now it will fatally error out.

Reported-by: mcgrailm <mgm19@psu.edu>
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2008-07-05 03:14:32 -04:00
parent 594268ca3b
commit c845f0bb78
3 changed files with 20 additions and 1 deletions

View File

@@ -38,6 +38,17 @@ class HTMLPurifier_EncoderTest extends HTMLPurifier_Harness
);
}
function test_convertToUTF8_spuriousEncoding() {
// We don't support this as UTF-8, because UTF-8 is the default and
// shouldn't be set if not necessary.
$this->config->set('Core', 'Encoding', 'utf8');
$this->expectError('Invalid encoding utf8');
$this->assertIdentical(
HTMLPurifier_Encoder::convertToUTF8("\xF6", $this->config, $this->context),
''
);
}
function test_convertToUTF8_iso8859_1() {
$this->config->set('Core', 'Encoding', 'ISO-8859-1');
$this->assertIdentical(