mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-31 19:30:21 +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:
@@ -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(
|
||||
|
Reference in New Issue
Block a user