1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Minor, don't explode when mbstring is missing and don't do utf8-to-utf8 conversions.

This commit is contained in:
epriestley 2012-07-02 19:34:59 -07:00
parent 563230b0fb
commit d3313e3fd7

View file

@ -835,15 +835,19 @@ EOTEXT
} }
} }
if ($try_encoding) { if ($try_encoding && $try_encoding != 'UTF-8') {
// NOTE: This feature is HIGHLY EXPERIMENTAL and will cause a lot if (!function_exists('mb_convert_encoding')) {
// of issues. Use it at your own risk. throw new ArcanistUsageException(
"This diff includes a file encoded in '{$try_encoding}', ".
"but you don't have the PHP mbstring extension installed ".
"so it can't be converted to UTF-8. Install mbstring.");
}
$corpus = mb_convert_encoding($corpus, 'UTF-8', $try_encoding); $corpus = mb_convert_encoding($corpus, 'UTF-8', $try_encoding);
$name = $change->getCurrentPath(); $name = $change->getCurrentPath();
if (phutil_is_utf8($corpus)) { if (phutil_is_utf8($corpus)) {
$this->writeStatusMessage( $this->writeStatusMessage(
"[Experimental] Converted a '{$name}' hunk from ". "Converted a '{$name}' hunk from '{$try_encoding}' ".
"'{$try_encoding}' to UTF-8.\n"); "to UTF-8.\n");
$hunk->setCorpus($corpus); $hunk->setCorpus($corpus);
continue; continue;
} }