Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I find the UTF-8 version of the Octal '\033c'

I am working on a Javscript project with the following code…

process.stdout.write('\033c');

The IJ tooltip says

Octal escape sequences are not allowed

So I am pretty sure I just need to convert the \033c to UTF-8 but since it is kind of a weird char I am not sure I am understanding things properly.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I tried this…

process.stdout.write("\\033c");

per this but it still has the same issue

>Solution :

This has nothing to with UTF-8. \033c is supposed to be two characters: \033 (the ESC control character, code point U+001B) and c (a regular lower-case c).

The error says that octal escape sequences are not allowed, so let’s use hex instead. Octal 33 converted to hexadecimal is 1B, so you can use \x1b*. In combination with the c you get \x1bc.

For more information, see the section about escape sequences on MDN.

*: You could also use \u001b instead of \x1b but for characters in the range of U+0000 to U+00FF it doesn’t matter.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading