| | |
| | | { |
| | | return array( |
| | | array('', ''), |
| | | array("\xC1", ''), |
| | | array("\xC1", ""), |
| | | array("Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν", "Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν"), |
| | | ); |
| | | } |
| | | |
| | |
| | | function test_clean($input, $output) |
| | | { |
| | | $this->assertEquals($output, rcube_charset::clean($input)); |
| | | } |
| | | |
| | | /** |
| | | * Just check for faulty byte-sequence, regardless of the actual cleaning results |
| | | */ |
| | | function test_clean_2() |
| | | { |
| | | $bogus = "сим\xD0вол"; |
| | | $this->assertRegExp('/\xD0\xD0/', $bogus); |
| | | $this->assertNotRegExp('/\xD0\xD0/', rcube_charset::clean($bogus)); |
| | | } |
| | | |
| | | /** |
| | |
| | | $this->assertEquals($output, rcube_charset::detect($input, $fallback)); |
| | | } |
| | | |
| | | /** |
| | | * Data for test_detect() |
| | | */ |
| | | function data_detect_with_lang() |
| | | { |
| | | return array( |
| | | array('Åã¥Ü¦WºÙ,¥Dn', 'zh_TW', 'BIG-5'), |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * @dataProvider data_detect_with_lang |
| | | */ |
| | | function test_detect_with_lang($input, $lang, $output) |
| | | { |
| | | $this->assertEquals($output, rcube_charset::detect($input, $output, $lang)); |
| | | } |
| | | |
| | | } |