@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use phutil_utf8_convert() in Phabricator

Summary: See D3252.

Test Plan: This one is nasty to test, I'm going to make some coffee first.

Reviewers: davidreuss, vrana, btrahan

Reviewed By: davidreuss

CC: aran

Maniphest Tasks: T452

Differential Revision: https://secure.phabricator.com/D3254

+8 -16
+3 -2
scripts/mail/mail_handler.php
··· 34 34 $content_type = idx($text_body_headers, 'content-type'); 35 35 if ( 36 36 !phutil_is_utf8($text_body) && 37 - preg_match('/charset="(.*?)"/', $content_type, $matches) 37 + (preg_match('/charset="(.*?)"/', $content_type, $matches) || 38 + preg_match('/charset=(\S+)/', $content_type, $matches)) 38 39 ) { 39 - $text_body = mb_convert_encoding($text_body, "UTF-8", $matches[1]); 40 + $text_body = phutil_utf8_convert($text_body, "UTF-8", $matches[1]); 40 41 } 41 42 42 43 $headers = $parser->getHeaders();
+3 -4
src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
··· 318 318 return; 319 319 } 320 320 321 - $encoding = $repository->getDetail('encoding', 'utf-8'); 321 + $encoding = $repository->getDetail('encoding', 'UTF-8'); 322 322 323 323 $result = null; 324 324 $patch_error = null; ··· 347 347 if ($len <= $inline_patches) { 348 348 // We send email as utf8, so we need to convert the text to utf8 if 349 349 // we can. 350 - if (strtolower($encoding) != 'utf-8' && 351 - function_exists('mb_convert_encoding')) { 352 - $raw_patch = mb_convert_encoding($raw_patch, 'utf-8', $encoding); 350 + if ($encoding) { 351 + $raw_patch = phutil_utf8_convert($raw_patch, 'UTF-8', $encoding); 353 352 } 354 353 $result = phutil_utf8ize($raw_patch); 355 354 }
+2 -10
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryGitCommitMessageParserWorker.php
··· 37 37 $parts = explode("\0", $info); 38 38 $encoding = array_shift($parts); 39 39 40 - // See note above - git doesn't always convert the encoding correctly. 41 - $do_convert = false; 42 - if (strlen($encoding) && strtoupper($encoding) != 'UTF-8') { 43 - if (function_exists('mb_convert_encoding')) { 44 - $do_convert = true; 45 - } 46 - } 47 - 48 40 foreach ($parts as $key => $part) { 49 - if ($do_convert) { 50 - $parts[$key] = mb_convert_encoding($part, 'UTF-8', $encoding); 41 + if ($encoding) { 42 + $part = phutil_utf8_convert($part, 'UTF-8', $encoding); 51 43 } 52 44 $parts[$key] = phutil_utf8ize($part); 53 45 }