Re: OT: Unicode and vi(m). Was Re: Great SWT Program



In article <1189987904.513357.112450@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<nebulous99@xxxxxxxxx> wrote:
On Sep 15, 12:05 pm, blm...@xxxxxxxxxxxxx <blm...@xxxxxxxxxxxxx>
wrote:
Well, I was curious ....

Running console-mode vim (not gvim) in GNOME's terminal emulator
program on my Linux system, I saw all the characters in the post
by RedGrittyBrick.

There's some sort of cheating going on under the hood there, then,
unless there was manglage you couldn't recognize not being familiar
with all of the languages in question.

It finally occurred to me that it would be easy enough to view
RedGrittyBrick's post in GG's archives by searching on message ID.
I did so, and the characters look the same there (displayed using
Firefox under GNOME) as they do in vim in a terminal emulator
under GNOME (I tried GNOME's emulator and also xterm).

They do *not* look the same if I run vim in one of Linux's virtual
text consoles; there, most of them show up as garbled stuff I won't
bother to cut and paste in. One reason for the difference is that
vim apparently starts with different initial values for "encoding"
in the two different environments; "latin1" in a text console,
"utf8" in a terminal emulator window. Setting encoding=utf8 in
a text console, I get solid boxes. That's no surprise.

Most likely the sneaky bit is
buried somewhere in the phrase "GNOME's terminal emulator".

Almost certainly. As best I can tell from a few experiments
tracing system calls, vim sends pretty much the same thing to
standard output no matter what kind of terminal/emulator it's
being run in (the "pretty much" is because there are differences
in the escape sequences used to position text, etc.). That a
genuine text-console environment would not know what to do with
what appear to be multi-byte characters (UTF-8?), and a terminal
emulator would, doesn't surprise me. Apparently the people who
write these emulator programs don't mind providing features not
possible with the hardware they claim to be emulating. <shrug>

I
challenge anyone to make something like this work on the actual,
honest-to-God console, no X services running, no WM loaded, no
nothing. Preferably on an old 386 with only an EGA card so it will be
frankly obvious if the software has "cheated" and is using graphics
mode because everything looks like a Saturday-morning cartoon modulo
blocky pixelization. :)

That would be interesting, if possible.

If it's not possible, what does that prove?

As far as I know, vim and other text-mode programs are designed
to run correctly in a variety of terminal environments and take
advantage of whatever features are provided by the current
environment (e.g., reverse video, underlining). That they
can also make use of a terminal emulator's ability to display
glyphs[*] that couldn't be displayed on one of those plain-text
consoles of days past to me seems like a logical extension of this
ability to use different kinds of terminals. Is that "cheating"?
whatever you mean by that ....

[*] I think that's the word I want -- something that includes
characters from different alphabets, non-alphabetic symbols, etc.

--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.
.