Skip to main content
Question

.NET COBOL Strange behaviour when source file encoded to UTF-8 BOM

  • July 13, 2026
  • 2 replies
  • 16 views

Peter Restorick
Forum|alt.badge.img+2

Hi,

When the source file (CBL) and any ancillary copybooks have been saved with an encoding of UTF-8 BOM then I am getting some strange behaviour with characters such as high-values when moving a PIC X group into a string and then moving it back out into a PIC X group.

My question is whether there a compiler option or some other mechanism whereby the source files are automatically converted to ASCII or UTF-8 at the time of building the dll?

Thanks

2 replies

Chris Glazier
Forum|alt.badge.img+4

Hi Peter,

There is a directive SOURCE-ENCODING that might help you out.


Peter Restorick
Forum|alt.badge.img+2

Thanks Chris, 

I will look into this - we have tried the RUNTIME-ENCODING”UTF-8” but that did cause issues for us (I forget the detail). It does appear as if the SOURCE-ENCODING does have an impact on the RUNTIME-ENCODING so am a bit concerned with that.

Peter