Page MenuHomePhorge

Catch RuntimeException: mb_convert_encoding(): Illegal character encoding specified at PhabricatorTextDocumentEngine.php:73
Needs ReviewPublic

Authored by aklapper on Aug 22 2023, 17:24.
Referenced Files
Unknown Object (File)
Fri, Sep 22, 23:47
Unknown Object (File)
Thu, Sep 21, 14:46
Unknown Object (File)
Sun, Sep 17, 12:38
Unknown Object (File)
Sat, Sep 16, 14:16
Unknown Object (File)
Sat, Sep 16, 08:05
Unknown Object (File)
Tue, Sep 12, 10:02
Unknown Object (File)
Mon, Sep 11, 12:43
Unknown Object (File)
Tue, Aug 29, 09:22



When given $encoding is invalid, catch the exception to show a proper error message and make the server logs provide more hints.

EXCEPTION: (RuntimeException) mb_convert_encoding(): Illegal character encoding specified at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#1 <#2> mb_convert_encoding(string, string, string) called at [<phabricator>/src/applications/files/document/PhabricatorTextDocumentEngine.php:73]

Closes T15624

Test Plan

Unclear. Probably reading the code carefully.

Diff Detail

rP Phorge
T15624charenc (branched from master)
Lint Passed
Tests Passed
Build Status
Buildable 802
Build 802: arc lint + arc unit

Event Timeline

Please do note that this patch is untested as I am unaware of reproduction steps.

Sten added inline comments.

We get $message, but don't make use of it. Shouldn't we include $message in the log rather than. assuming it's an Illegal character encoding?

Also, should we set $this->encodingMessage to the error message?