What does `\x1b(B` do?

2024/11/15 9:18:48

I'm a Blessed user, and recently, when I tried to find out the contents of the term.bold() function, I got this output: \x1b[1m\x1b(B\x1b[m

I understand what \x1b[1m and \x1b[m do, but what does \x1b(B do? I tried printing it, but it doesn't seem to do anything at all.

Thanks in advance!

Answer

The control sequence \x1b(B selects the default character set ASCII. See XTerm Control Sequences:

ESC ( C   Designate G0 Character Set (ISO 2022, VT100).Final character C for designating 94-character sets.  In thislist, 0 , A  and B  apply to VT100 and up, the remainder toVT220 and up.  The VT220 character sets, together with thePortuguese character set are activated by the NationalReplacement Character controls.  The A  is a special case,since it is also activated by the VT300-control for BritishLatin-1 separately from the National Replacement Charactercontrols....C = B  -> United States (USASCII).

That is provided just in case the terminal was set to some other character set, e.g., line-drawing. Blessed is probably retrieving this as part of \x1b(B\x1b[m, e.g., in

    normal = tigetstr('sgr0')

Further reading:

  • How do I get color with VT100?
  • VT100.net
https://en.xdnf.cn/q/72133.html

Related Q&A

Not clicking all tabs and not looping once issues

I am trying to click the tabs on the webpage as seen below. Unfortunately, it only seems to click some of the tabs despite correct correct xpath in inspect Chrome. I can only assume it’s not clickin…

Opencv stream from a camera connected to a remote machine

I am developing a wx application in python for streaming and displaying video from two different webcams. This works fine, but now I need to do this in a different scenario in which the two cameras are…

Is there a callable equivalent to f-string syntax?

Everybody loves Python 3.6s new f-strings:In [33]: foo = {blah: bang}In [34]: bar = blahIn [35]: f{foo[bar]} Out[35]: bangHowever, while functionally very similar, they dont have the exact same semanti…

Python: list comprehension based on previous value? [duplicate]

This question already has answers here:Python list comprehension - access last created element(9 answers)Closed 10 months ago.Say I want to create a list using list comprehension like:l = [100., 50., 2…

How to run a coroutine inside a context?

In the Python docs about Context Vars a Context::run method is described to enable executing a callable inside a context so changes that the callable perform to the context are contained inside the cop…

Random Forest interpretation in scikit-learn

I am using scikit-learns Random Forest Regressor to fit a random forest regressor on a dataset. Is it possible to interpret the output in a format where I can then implement the model fit without using…

Why are three apostrophes needed for print in Python?

Im making this Pythagoras Theorem Calculator in Python 3.3.2.I made print over several lines so that I could make a diagram:print("Welcome to the Pythagoras Theorem Calculator, powered by Python!&…

Downloading files from public Google Drive in python: scoping issues?

Using my answer to my question on how to download files from a public Google drive I managed in the past to download images using their IDs from a python script and Google API v3 from a public drive us…

Change locale for django-admin-tools

In my settings.py file I have:LANGUAGE_CODE = ru-RUalso, I have installed and working django-admin-tools. But admin language still english. What Im doing wrong?PS.$ cat settings.py | grep USE | grep -…

Container localhost does not exist error when using Keras + Flask Blueprints

I am trying to serve a machine learning model via an API using Flasks Blueprints, here is my flask __init__.py filefrom flask import Flaskdef create_app(test_config=None):app = Flask(__name__)@app.rout…