Page MenuHomePhabricator

D9615.id.diff
No OneTemporary

D9615.id.diff

diff --git a/src/utils/__tests__/PhutilUTF8TestCase.php b/src/utils/__tests__/PhutilUTF8TestCase.php
--- a/src/utils/__tests__/PhutilUTF8TestCase.php
+++ b/src/utils/__tests__/PhutilUTF8TestCase.php
@@ -112,8 +112,8 @@
"\xe6\x9d\xb1\xCD\xA0y" => 3,
// Colors and formatting.
- "\e[1mx\e[m" => 1,
- "\e[1m\e[31mx\e[m" => 1,
+ "\x1B[1mx\x1B[m" => 1,
+ "\x1B[1m\x1B[31mx\x1B[m" => 1,
);
foreach ($strings as $str => $expect) {
$this->assertEqual(
diff --git a/src/utils/utf8.php b/src/utils/utf8.php
--- a/src/utils/utf8.php
+++ b/src/utils/utf8.php
@@ -191,7 +191,7 @@
function phutil_utf8_console_strlen($string) {
// Formatting and colors don't contribute any width in the console.
- $string = preg_replace('/\e\[\d*m/', '', $string);
+ $string = preg_replace("/\x1B\[\d*m/", '', $string);
// In the common case of an ASCII string, just return the string length.
if (preg_match('/^[\x01-\x7F]*\z/', $string)) {

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 6, 4:26 AM (6 d, 10 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7227818
Default Alt Text
D9615.id.diff (982 B)

Event Timeline