}
}
- if ($try_encoding) {
- // NOTE: This feature is HIGHLY EXPERIMENTAL and will cause a lot
- // of issues. Use it at your own risk.
+ if ($try_encoding && $try_encoding != 'UTF-8') {
+ if (!function_exists('mb_convert_encoding')) {
+ 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);
$name = $change->getCurrentPath();
if (phutil_is_utf8($corpus)) {
$this->writeStatusMessage(
- "[Experimental] Converted a '{$name}' hunk from ".
- "'{$try_encoding}' to UTF-8.\n");
+ "Converted a '{$name}' hunk from '{$try_encoding}' ".
+ "to UTF-8.\n");
$hunk->setCorpus($corpus);
continue;
}