Skip to main content

encode of a string

  • November 16, 2023
  • 2 replies
  • 1 view

M Carmen De Paz
Forum|alt.badge.img+2

Hi, is it possible to know the encode of a string in cobol?

2 replies

Chris Glazier
Forum|alt.badge.img+2

Hi, is it possible to know the encode of a string in cobol?

Can you provide more detail on what you would like to do? Is this data from a file that you are reading?

Visual COBOL supports ASCII and EBCDIC character sets for storing alphanumeric data and PIC N for UTF-16 and PIC U for UTF-8 characters.

I don't know of a way to determine the type of encoding for a random string of characters...


M Carmen De Paz
Forum|alt.badge.img+2
  • Author
  • Participating Frequently
  • November 17, 2023

Can you provide more detail on what you would like to do? Is this data from a file that you are reading?

Visual COBOL supports ASCII and EBCDIC character sets for storing alphanumeric data and PIC N for UTF-16 and PIC U for UTF-8 characters.

I don't know of a way to determine the type of encoding for a random string of characters...

Hi, Chris.

We don't read a file, the text is transferred from a Windows server in a buffer text and stored in a working variable, then inserted into a utf8-encoded database.

The problem is that , when we do the insert of a text with tilde (accent), the Db magager returns us an error.

whe found the function cbl_string_convert to force the encoding to UTF-8,but the function needs the in-encodig and we don´t know it.

so , we need a way to know the in-encodig of the buffer text