From 501c90bb30ab983de895b9c58b213c1df55cdc52 Mon Sep 17 00:00:00 2001 From: John Stockdale Date: Sat, 12 Nov 2011 00:06:44 +0000 Subject: [PATCH] Use Git's encoding flag instead of MBString Summary: 0d5b0f21ad2bc03988b007b017e44d4210ab9645 added string conversion but MBString always needs an argument for endcoding. It looks like we can get away with doing this in git instead, with the --encoding='UTF-8' flag. Then we should be safe to remove the test for output type, and stay UTF-8 safe. Test Plan: Run updaters with change. Verify commits are updated. Reviewers: epriestley CC: Differential Revision: 1108 --- ...PhabricatorRepositoryGitCommitMessageParserWorker.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/applications/repository/worker/commitmessageparser/git/PhabricatorRepositoryGitCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/git/PhabricatorRepositoryGitCommitMessageParserWorker.php index 7ac096d0d8..4d18075abe 100644 --- a/src/applications/repository/worker/commitmessageparser/git/PhabricatorRepositoryGitCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/git/PhabricatorRepositoryGitCommitMessageParserWorker.php @@ -26,15 +26,10 @@ class PhabricatorRepositoryGitCommitMessageParserWorker // NOTE: %B was introduced somewhat recently in git's history, so pull // commit message information with %s and %b instead. list($info) = $repository->execxLocalCommand( - 'log -n 1 --pretty=format:%%e%%x00%%an%%x00%%s%%n%%n%%b %s', + "log -n 1 --encoding='UTF-8' --pretty=format:%%an%%x00%%s%%n%%n%%b %s", $commit->getCommitIdentifier()); - list($encoding, $author, $message) = explode("\0", $info); - - if ($encoding != "UTF-8") { - $author = mb_convert_encoding($author, 'UTF-8', $encoding); - $message = mb_convert_encoding($message, 'UTF-8', $encoding); - } + list($author, $message) = explode("\0", $info); // Make sure these are valid UTF-8. $author = phutil_utf8ize($author);