Specifying character encoding

When using Eclipse for COBOL development, you need to ensure that each of the following settings are compatible with how the content within your program source files is encoded:

  • Text file encoding - the setting that determines the encoding used to display program source files within the editor, for a particular workspace.
  • SOURCE-ENCODING directive - the project-specific encoding used during compilation (and subsequently run time, unless the RUNTIME-ENCODING directive is also set).
    Note: If this setting is not specified (and the source does not contain a BOM), an encoding of UTF-8 is used by default.

If there are any incompatibilities with the text encoding setting, the contents may not display correctly within the editor, and if there are also incompatibilities with the directive setting, the compiled output may not be as expected.

Setting the default text file encoding:

To set the default text file encoding:

  1. On the Window menu, select Preferences > General > Workspace.

    The Workspace-specific settings page is displayed.

  2. In the Text file encoding section, select the appropriate option: either select the Default option, or select from a list of Other settings.

    Text file encoding option

  3. Click OK.

The setting applies to subsequent new projects in the current workspace only. To set the default for other workspaces, you must first switch to them and then repeat these instructions.

Setting the source-encoding for a project

To set the source-encoding for a project

  1. In COBOL Explorer, ensure that your project is selected, then on the Project menu, click Properties.

    The Properties for <project-name> dialog box appears.

  2. Select Micro Focus > Project Settings > COBOL.
  3. Click the Value cell to the right of the Source encoding field and select the appropriate value.
  4. Click Apply and Close.

The selected encoding is used for the entire project. You can override this value by setting the encoding at other levels within the project, such as in build configurations or folders.