PHPUnitで文字コード関連のWarningが出るとき

このエントリーをはてなブックマークに追加
はてなブックマーク - PHPUnitで文字コード関連のWarningが出るとき
Share on Facebook

XAMPP環境でPHPUnitを使おうと思ったら以下のような警告が出ました。(テスト自体は実行できます)

PHPUnit 3.4.15 by Sebastian Bergmann.


Warning: DOMElement::setAttribute(): string is not in UTF-8 in C:\xampp\php\PEAR\PHPUnit\Util\Log\JUnit.php on line 307

Warning: DOMElement::setAttribute(): string is not in UTF-8 in C:\xampp\php\PEAR\PHPUnit\Util\Log\JUnit.php on line 421
I
Warning: DOMDocument::saveXML(): output conversion failed due to conv error, bytes 0x82 0xC4 0x82 0xB7 in C:\xampp\php\PEAR\PHPUnit\Util\Log\JUnit.php on line 474


Time: 1 second, Memory: 5.25Mb

OK, but incomplete or skipped tests!
Tests: 1, Assertions: 0, Incomplete: 1.

いろいろ調べた結果、ソースディレクトリに日本語が使われているのが問題でした。このケースでは「c:\temp\てすと」なんてディレクトリに入れていました。

開発のとき日本語ディレクトリを使うのはやめましょう。

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>