[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Re: DOS v Win encoding
- Subject: Re: DOS v Win encoding
- From: "Robert Holmgren" holmgren@xxxxxxxx
- Date: Fri, 2 May 2008 18:23:36 -0400
** Reply to message from Bill Troop on
Thu, 01 May 2008 12:27:43 +0100
> Wouldn't it be nice to able to press a key and get XyWrite to see
> upper-Ascii in a different flavor? Is there some way of doing this
> that I have been unaware of all this time?
Bill, you're talking about CodePages. Read up on them --
there's oodles of info. XyWrite4's native CPs are 437
(US-Ascii) and 850 (Western Europe, also called ISO-8859-1).
Windows' CP is 1252 (Windows ANSI or Windows Latin 1). Mac's is
who-knows-what, probably 10000 for the old Mac OS, and UTF-8 for
OS X. UTF-8 is basically the same as 1252 above character 160,
but there are plenty of additional encodings that don't occur
within the 1-byte 0-255 range, and thus are difficult to display
in XyWrite. (I thought you were a font guru? Or am I confusing
you with somebody else?)
Yes, you can "press a key" in Xy4 and toggle between the
*display* of 437|850 and 1252 (it doesn't convert the underlying
codes, but merely displays the underlying codes in the
designated CodePage -- THEREFORE, if you want to compose in
1252, you should display in 1252 while writing so you can see
what you're doing). The "key" to press is "ANSIFS" for
1252, "VGARST" for 437|850. There are a couple of
simple prerequisites to make this work -- see "HELP
ANSITY" for more. Obviously, if you display the
character set (e.g. with TABLE CHAR), you'll see the
different assignments of the different CodePages.
The miraculous thing about U2's CLIP utility is that it DOES
convert actual underlying code between character sets, and you
can use it to convert between XyWrite and another program, OR
between one XyWrite window and another XyWrite window!
Here I will explain how to convert texts within XyWrite:
=============Convert Xy4 CP850 Text to CP1252 ===============
You have a text written in CP850 in the current window
IMPORTANT: Toggle into Draft mode (NOT eXPanded) -- Draft mode
**displays the text in CP850** if "DEFAULT LA=850" (whereas
eXPanded mode displays in CP437, always)
DeFine the whole text
Command (cursor must be in Text, not on the CMline, when you
hit !):
CLIPWC
Open a second Xy4 window
IMPORTANT: Toggle into Draft mode, if necessary ("NE/1" will
force this)
Command (make sure cursor is in Text, not on the CMline!):
CLIPWP 850
Command:
ANSIFS to toggle to CP1252 character set for display
Your CP850 text has been genuinely converted to CP1252!
=============Convert CP1252 Text to Xy4 CP850 ===============
CAll the CP1252 text into a Draft mode window (you might use
"CA/1" to ensure that it is displayed in Draft mode)
Command:
ANSIFS to prove that it is indeed a CP1252 text
DeFine the whole text
Command (make sure cursor is in Text, not on the CMline!):
CLIPWC 850
Command:
VGARST to return to CP850 character set for display
Open a second Xy4 window
IMPORTANT: Toggle into Draft mode, if necessary ("NE/1")
Command (make sure cursor is in Text, not on the CMline!):
CLIPWP
Your CP1252 text has been genuinely converted to CP850!
================================================
Note the arguments above ("850") to CLIPWP and CLIPWC. What do
they do?
First, you need to understand the basic behavior of CLIP.EXE.
By default, it makes a conversion. The whole purpose of the
bloody utility is to move XyWrite texts to and from the Windows
world. Windows operates almost totally in CP1252. XyWrite
doesn't understand 1252 -- it operates in CP850 (or 437).
Therefore, the default behavior is to COPY text from XyWrite to
CP1252 and put it on the Windows Clipboard, and to PASTE CP1252
text from the Windows Clipboard into a XyWrite window in
CP850|437.
CLIP.EXE takes two numeric CodePage arguments:
CLIP.EXE TargetCodePage SourceCodePage
(Basically, for XyWrite purposes, the only CodePages used are
437, 850, and 1252 -- but in fact CLIP.EXE is capable of
converting between the single-byte (0-255) characters of ANY
CodePages, which makes this a handy general purpose utility, IF
you know how to use it. Believe it or not, CLIP.EXE actually
converts to Unicode and then back to single byte -- so it would
be a trivial matter to adapt CLIP.EXE to do SBCS to Unicode
conversions and v.v. -- not that I see a particular use for
that.)
The Target parameter above can be controlled by the user when
Copying (default=1252); and the Source parameter can be
controlled by the user when Pasting (again, default=1252).
Target when Pasting and Source when Copying canNOT be controlled
by the user (except at a DOS command line, which is another
story entirely): these values are automatically determined by
frame CLIPW*, and are either 850 or 437, depending on the
current value of ).
If you think about it, the scheme makes common sense: the
Target of a Copy operation is the Clipboard, and generally you
want it to be 1252; the Source of a Paste into Xy4 is also the
Clipboard, again usually 1252.
So what happens normally? When you Copy, the Target is 1252 and
the Source is either 437 or 850. A conversion needs to take
place. Suppose, however, that the Target was the same as the
Source: 437 in the case of eXPanded mode text or an embedded
command, otherwise 850. If the Target is 850 and the
Source is 850, i.e. if the values are identical, then
conversion is skipped.
OK. Suppose your Xy4 text is actually composed in 1252, using
the ANSIFS font gimmick or a full-blown ANSIfied XyWrite
installation like Manuel uses. You want to Copy this text to
the Clipboard but you do NOT want to convert it, because it's
already in 1252! Therefore the thing to do is to trick CLIPWC
into thinking that Source and Target are identical. Since you
can't control Source (either 437 or 850), you have to set Target
to either 437 or 850 too. Figure out what your current VALA
value is ("VA/NV LA"), and use it:
CLIPWC 850
That puts your file on the clipboard in 1252. To Paste it back
into XyWrite as 850, simply issue CLIPWP with no argument -- by
default CLIP.EXE converts the text to CP850.
Conversely, to turn a CP850 text into a CP1252 text in a XyWrite
window, Copy it normally to the Clipboard (where it is
auto-converted to 1252), then trick XyWrite into Pasting it back
into a Xy4 window without converting it, by using the current
value of , e.g.
CLIPWP 850
If anybody would like to know how to use CLIP.EXE as a
standalone text conversion tool, I'll be happy to explain it --
but for now, enough.
-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------