Fixed missing detection of ISO-8859-2 characters.
This commit is contained in:
parent
77c7f8ecfe
commit
a5f97c59d9
@ -171,7 +171,7 @@ class IDF_Commit extends Pluf_Model
|
|||||||
*/
|
*/
|
||||||
public static function toUTF8($text)
|
public static function toUTF8($text)
|
||||||
{
|
{
|
||||||
$enc = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS';
|
$enc = 'ASCII, UTF-8, ISO-8859-2, ISO-8859-1, JIS, EUC-JP, SJIS';
|
||||||
$ref = $text;
|
$ref = $text;
|
||||||
if (is_array($text)) {
|
if (is_array($text)) {
|
||||||
$ref = $text[0];
|
$ref = $text[0];
|
||||||
|
@ -58,4 +58,22 @@ class IDF_Tests_TestGit extends UnitTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* parse a log encoded in iso 8859-2
|
||||||
|
*/
|
||||||
|
public function testParseIsoLog2()
|
||||||
|
{
|
||||||
|
$log_lines = preg_split("/\015\012|\015|\012/", file_get_contents(dirname(__FILE__).'/data/git-log-iso-8859-2.txt'));
|
||||||
|
$log = IDF_Scm_Git::parseLog($log_lines);
|
||||||
|
$titles = array(
|
||||||
|
'Dodałem model',
|
||||||
|
'Dodałem model',
|
||||||
|
);
|
||||||
|
foreach ($log as $change) {
|
||||||
|
$this->assertEqual(array_shift($titles),
|
||||||
|
IDF_Commit::toUTF8($change->title));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
12
src/IDF/Tests/data/git-log-iso-8859-2.txt
Normal file
12
src/IDF/Tests/data/git-log-iso-8859-2.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
commit 11531a9dbc64a65150f2f38fbea7cef9d478a123
|
||||||
|
Author: unknown <a@(none)>
|
||||||
|
Date: Fri Jul 3 01:44:11 2009 +0200
|
||||||
|
|
||||||
|
Doda³em model
|
||||||
|
|
||||||
|
commit 11531a9dbc64a65150f2f38fbea7cef9d478a123
|
||||||
|
Author: unknown <a@(none)>
|
||||||
|
Date: Fri Jul 3 01:44:11 2009 +0200
|
||||||
|
|
||||||
|
Doda³em model
|
||||||
|
|
Loading…
Reference in New Issue
Block a user