Monday, July 25, 2022

[SOLVED] What are these weird characters in my system log? (\x{1B}, U+2026)

Issue

I was looking into an Ubuntu crash on EC2, so I pulled the system log. What are these weird characters?

I looked the circled one up on rel="nofollow noreferrer">https://unicodelookup.com/#%1B/1 and got this: \x{1B}

enter image description here

They are even more obnoxious on VS Code... VS Code says the yellow one is U+2026 enter image description here

Why are these rendering like this?


Solution

U+001B is the ESC control code, and it is being used in this case to inject ANSI control sequences into a terminal that supports them. <ESC>[0;32m sets text to green (IIRC) and <ESC>[0m returns text to the default color. Unfortunately they don't redirect to a file well. Blame the logger. Different IDEs display control codes differently as you've found.

Read more about it: https://en.wikipedia.org/wiki/ANSI_escape_code

U+2026 is the Unicode character HORIZONTAL ELLIPSIS () and it looks like it was used to truncate a portion of the log.

A simple example in Python with the colorama module that enables ANSI escape codes. Note that in the Windows terminal ESC shows as yet another "weird symbol":

colorama example showing untranslated control codes and then translated green text



Answered By - Mark Tolonen
Answer Checked By - Mildred Charles (WPSolving Admin)