Set File Encoding Dialog

The Set File Encoding dialog is available from the Commands menu in the main window. It allows you to change a file's file type to Unicode or ANSI.

This command has the same effect as opening a file in Notepad (under windows 2000 or XP) and changing the Encoding via the SaveAs dialog. Except FAR allows you to convert foreign language files using the Code Page select dropdown. Plus you can convert many files at a time.

Note: In the FAR main window the selected file's encoding is displayed in the status line under the FAR file list. You can also enable the "Encoding" column for the FAR file list from the View menu (although this does tend to slow down the file list since every file in the list needs to be read).

Encoding

Choose the type of file encoding you want to change your files to.
Normally you would check "Add BOM" since most Microsoft application rely on the Byte-Order Mark file signature to recognize the  encoding type. For more information see Unicode Support in FAR.

Code Page - Select an ANSI Code Page to use

A code page is required only when converting files from Unicode to ANSI, or ANSI to Unicode. Otherwise ignore this setting. Initially this is set to the current ANSI code page of the operating system. See Windows "Control Panel > Regional and Language Options" dialog.

Typically the first 15 items in the list (those prefixed with "ANSI") are the ones you need for the Windows operating system.

To make this easier you can also select the code page by choosing the required language from the second dropdown list. You will notice the code page (top list) is selected when you select a language from the second list.

Note:

Source file encoding detection method

Select an "Encoding Detection Method" if you want to convert Unicode files that do not have a Unicode file signature (BOM).

Normally Unicode files are recognized by their Byte-Order Mark file signature. For UTF-16 this is a leading 2 byte signature. For UTF-8 this is a leading 3 byte signature. ANSI files don't have a BOM signature.

Some applications such as XMetal create Unicode files without BOM signatures. Programs such as Windows NotePad correctly recognize these files because they examine the file content and make a guess. FAR does not do this. If you are unsure of a files encoding type, open the file in NotePad and read the encoding type from the File > Save As dialog.

To convert files that don't have a BOM signature you need to tell FAR the encoding of the source files. Use the Auto-detect option with caution. Here FAR is taking a guess at the encoding of files with no BOM.

Invalid Code Page dialog

Windows can not protect you from using the wrong code page when converting from ANSI (narrow) to Unicode (wide). However going from Unicode (wide) to ANSI (narrow) Windows will flag an error if a character cannot be converted under the selected Code Page. In this case FAR will display the Invalid Code Page dialog, showing you which characters could not be converted and allows you to select a better ANSI Code Page.

Range

Select All Files to change the encoding of all files in the FAR file list. Select Selected Files to change only the selected files. The later will be disabled if no files are selected.

Results

If a target file is already at the desired Encoding type then no action is performed on that file.

On completion, files modified will show Matches = 1 in the FAR file list. Files not modified (already at the requested encoding) will show Matches = 0. Files that could not be changed (file accessed error, or invalid Code Page error, or job was cancelled) will show Matches = empty (no text display).


http://www.HelpwareGroup.com/