SOURCE - Specify Character Encoding

Syntax


SOURCE

{ encoding-format }


Operands


encoding-format

ANSI | UTF8 | UTF16LE | UTF16BE | EBCDIC | user-format

Abbreviations and Aliases

ANSI can also be spelled as ASCII

UTF16LE can also be spelled as UTF16


Description


The SOURCE command is used to change the SOURCE attribute of a Profile.  It defines the character-set encoding format of all files with a given file type.


The encoding-format of a file is both its character set, and the way in which the character set is encoded as bits.  For ANSI and EBCDIC, these two concepts essentially mean the same thing.  For Unicode files, there is more than one way to encode them, and SPFLite supports the encoding forms noted above.  (There are additional ways to encode Unicode, but SPFLite only supports the ones listed.)


The current encoding format is displayed in the status bar at the bottom right of the screen.  


The SOURCE value is stored as part of the PROFILE options which are maintained individually by file type.


Limitations of SOURCE Encoding


At present, regardless of the SOURCE encoding of a file type, all files are internally processed using the ANSI character set while being edited or browsed.  This means that only 256 possible characters are representable in SPFLite, and they must be within the Ansi character set.  For the predefined EBCDIC to ANSI translation table, this is not a problem, because the translation used by SPFLite is lossless.  


For Unicode it is another matter.  Unicode can represent far more characters than ANSI can represent.  To successfully use SPFLite to edit Unicode-encoded files, the character set of such files must be limited to those characters that have a counterpart in the Ansi character set.  Sometimes this may be enough for editing UTF-8 encoded files such as HTML web pages, which are often merely UTF-8 conversions of simple ANSI files.


If you have extensive Unicode requirements (like editing files in Greek or Russian), these may be best met by a full-blown word processor like Microsoft Word rather than SPFLite.


EBCDIC Considerations


For EBCDIC files, the SOURCE format must be established in the file profile before the file is loaded since SPFLite needs to use the SOURCE value in the Profile while loading the file.  It needs this information to know ahead of time that it needs to make use of an EBCDIC to ANSI translation table.


The first time you access an EBCDIC file type not referenced before is problematic, since since there would be no current existing Profile for it.  The easiest way to resolve this is to do a PROFILE NEW command to create a new Profile for that file type, and set its SOURCE attribute to EBCDIC, before you first edit a file that is SOURCE EBCDIC.  See the PROFILE command for more information.


Working with user-defined translation tables


The EBCDIC translation table name is no longer a reserved, predefined keyword.  Instead, it exists as a file with the name of EBCDIC.SOURCE in the SPFLite directory.  This file is installed by default with the rest of SPFLite.  You are free to create your own translation tables.  For example, if you had your own variation of EBCDIC, you could call the file MYEBCDIC.SOURCE, and then enable it within your profile by issuing the command, SOURCE MYEBCDIC.


You are free to name your own translation-table files what you wish, except that the (non EBCDIC) names listed above are reserved.  


You can replace the installation-defined EBCDIC.SOURCE file if you really want to, but it is recommended that you not do that, so that the default EBCDIC table would always be available for you if you ever needed it.  For example, suppose you want to translate between IBM code page 1047 and ANSI.  You could call such a table CP1047.SOURCE and enable it with SOURCE CP1047.  


The .SOURCE translation files are now in a new format from prior SPFLite releases.  


See Handling Non-Windows Text Files for more information.


Unicode Considerations







Created with the Personal Edition of HelpNDoc: Create help files for the Qt Help Framework