question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Legacy Support Options (16 colors & ASCII encoding)

See original GitHub issue

TODO

  • 16 colors mode (option colors=2|16|256|true, 256 by default)
  • output encoding (option encoding=, utf-8 by default)

Details

First, let me say I love this app. It produces lovely results on the command line.

I run a telnet BBS and would love the ability to curl the output of wttr.in to an ANSI file, so that said ANSI file can be viewed by users on my BBS. However, two things are stopping me from doing that:

  1. The BBS software I’m using (Synchronet, and probably most others) has no support for 256 color ANSI escape codes used in wttr.in’s output. As far as I can tell, the BBS software only supports the legacy 16 color escape codes.
  2. The output encoding of wttr.in (I’m guessing) is strictly UTF-8, which also does not render properly in the BBS. While I can set curl’s encoding to ASCII, the line-drawing characters do not translate properly when using that option.

To try to illustrate both issues, I’ll use the command curl wttr.in/NYC?n -o sample.ans to generate a sample ANS file. When viewing the resulting sample file in the ANSI editor PablowDraw, the attached screen is what displays.

image

If there were parameter options for both selecting either 16 or 256 color codes and selecting either ASCII or UTF-8 character encoding, that would produce great results that BBS sysops would love.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
chubincommented, Apr 5, 2021

Yes, I think both are doable. I updated the issue description, added both feature requests to it.

It will be possible to specify these two parameters with the following options:

  • encoding=
  • colors=
0reactions
CraigEMPcommented, Apr 5, 2021

@CraigEMP Accepted 16-colors request.

Nice, thank you!

Now about the encoding:

what what be the best solution?

  1. ASCII Only (see: #432, #113, #197, #221)
  2. No frames
  3. Encoding can be specified as the parameter

Of the issues listed in your ASCII Only option, issue #432 is doable, as it’s most similar to what I’m asking for, however it seemingly does not ask to keep support for the box and line drawing characters within Codepage 437, which make ANSI tables look very nice.

(side note: we should be careful to not conflate plain-text discussed in issues #113 and #197 with ASCII encoding; ASCII != plain-text)

The frameless display could be a decent workaround, but there are other characters that would still get interpreted incorrectly, like the degree and wind direction symbols, as well occasional dashes used for the sun’s rays (another screenshot attached).

image

Specifying the encoding sounds ideal, if it’s doable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Legacy Support Options (16 colors & ASCII encoding) - - Bountysource
Legacy Support Options (16 colors & ASCII encoding)
Read more >
ANSI escape code - Wikipedia
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video ... Other...
Read more >
Formatting codes - Minecraft Wiki - Fandom
A book showing the possible formatting options with the character that performs them. Formatting codes (also known as color codes) add color and ......
Read more >
CSS Color Module Level 4 - W3C
16 Default Style Rules; 17 Sample code for Color Conversions ... For legacy reasons, rgb() also supports a legacy color syntax that ...
Read more >
List of encodings that Node.js supports - Stack Overflow
When encoding a Buffer to a string, this encoding will omit padding. hex : Encode each byte as two hexadecimal characters. Legacy Character...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found