Avoiding Code Page Conflicts in .NET COBOL

Note: The following applies to .NET COBOL only.

Code pages are not often a consideration for traditional COBOL application development. However, they require attention in the advanced system Enterprise Developer, which interacts with the rich code page support of the Microsoft .NET framework.

Enterprise Developer follows the default behavior of Visual Studio by creating all auto-generated code files as UTF-8. The Compiler automatically compensates for this by detecting if the source code can be read as UTF-7/ASCII. If it cannot, all the files in a solution are saved as the appropriate code page, thereby avoiding corruption of PICTURE clause data items.

Code page conflicts can impact WPF and WCF projects, where by default:

To avoid code page conflicts, save all the auto-generated developer-editable .cbl files using the platform locale that matches the developer-generated of previously existing files, as follows:

  1. Ensure the source code from the file is displayed in the editor.
  2. Click File > Advanced Save Options.

    The advanced save dialog is displayed indicating the current code page for the file it UTF-8.

  3. Change the encoding to the platform default.
  4. Repeat the above for each auto-generated .cbl file.
  5. Save all the .cbl files under the same locale.
  6. Rebuild the solution.