-- Leo's gemini proxy

-- Connecting to gemini.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

in my usual terminal


syncterm works nicely for getting cp437 art to show up nicely when I telnet into somewhere, but I miss being able to click on links.

so I decided to make cp437 telnet work in the version of urxvt I have. Preferably without writing my own programs or patching.

I've ended up with a short shell script to hold all the parts together, and a few symlinks and Xresources, and a config file.


I was originally trying to just use iconv to convert the output from cp437 to utf-8.

Some buffering or whatever was preventing it from being usable. Tried a handful of stdbuf -o0 -i0 and python -c 'import pty;pty.spawn()' but they didn't seem to help iconv.


Eventually found a page on a nethack wiki.

https://nethackwiki.com/wiki/IBMgraphics#Using_konwert.2C_filterm.2C_or_cp437_.28any_terminal.29

tried cp437, filterm, and konwert and ended up using filterm.

cp437 was some git repo that didn't seem to work right away, so I skipped to another one.

filterm is part of the konwert package on debian, if you want to play with it too.


this kind of worked but telnet was running in line mode instead of character mode.

after reading enough of the telnet manpage I made a telnetrc to turn on character mode.

DEFAULT
	set localchars
	mode character

I'm not exactly sure why 'set localchars' is needed, but it doesn't actually go into character mode if it isn't there.

After that, it started working better.


While writing this part, I was going to explain about some other stuff I'd done, but, it seems to not be needed after all.

it was using that python line to run in a pty, and stty extproc.

neither were needed. make it small enough I don't need it in a script. just a line in uristart.conf.


if you don't mind having to type ctrl+Backspace or ctrl+H to get a backspace sent to the hosts that require it, that's it.


the frickin' backspace though.

it was sending ^? instead of ^H and after testing various things I decided it was the terminal emulator's fault.

for testing I used:

ncat -klp 1337 -x /dev/stderr >/dev/null

this helped with figuring out if I was actually in character mode more easily.


anyway, the terminal emulator I use is urxvt, and after grepping through the src dir a bit, I found some code about backspace, and worked it back to an Xresource name I can set to make the backspace key output a string of my choice.

nifty.

To keep this hack from possibly breaking my normal usage, I made a symlink in ~/.local/bin named 'x-terminaml-emulator-normie' so I could set these X resources to be only for terminals launched with that name.

I also wanted to keep the foreground color white because non-default colors might make a mess of some ANSI art. they kind of expect uncolored to be white it seems.


x-terminal-emulator-normie.foreground: white
x-terminal-emulator-normie.background: black
x-terminal-emulator-normie.backspacekey: ^H

so, that ^H is a literal ^H character. nano wouldn't let me enter that easily, so I opened it in vim, went to insert mode, and did ctrl+V ctrl+H then saved it.

last bit of the puzzle needed is this:

s telnet:	x-terminal-emulator-normie -e filterm ascii-ascii cp437-utf8 telnet '%d' '%P'

That's what my telnet link handler is now in my ~/.config/uristart.conf


I dunno.

The End.

-- Response ended

-- Page fetched on Sat Jun 1 06:35:57 2024