Highlighted
geozak Trusted Contributor.
Trusted Contributor.
268 views

conversion from utf-8 to Windows-1252

I get twice a day an utf-8 file

I try to convert it with: 

move function display-of (function national-of (input), 1252) to output

But the output looks like the intput.

Does somebody know a solution.

 

 

0 Likes
7 Replies
Micro Focus Expert
Micro Focus Expert

Re: conversion from utf-8 to Windows-1252

I haven't had to do this in COBOL myself, but looking at the product docs, and assuming "input" is defined as pic x(...), then I think this would only work if RUNTIME-ENCODING is set to "UTF8".

If RUNTIME-ENCODING isn't set, then it inherits whatever is set for SOURCE-ENCODING; and if SOURCE-ENCODING isn't set, it defaults to "ANSI", I believe.

So I think you'll need to compile your program with RUNTIME-ENCODING"UTF8". That will tell the NATIONAL-OF function that the input is UTF-8, which it can then convert to UTF-16 (the internal encoding used for pic n), which can then be converted to the Windows 1252 code page.

0 Likes
geozak Trusted Contributor.
Trusted Contributor.

Re: conversion from utf-8 to Windows-1252

when I set this I get

COBCH0053S Directive RUNTIME-ENCODING"UTF8" invalid or not allowed here

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: conversion from utf-8 to Windows-1252

OK, it's time to provide some actual useful information for us.

  • What product, version, and platform are you using?
  • Where did you set the directive? Did you consult the documentation for your product regarding the directive before setting it?

That sort of information should always be included when asking a question. We're not psychic. We only know what you tell us.

0 Likes
geozak Trusted Contributor.
Trusted Contributor.

Re: conversion from utf-8 to Windows-1252

Hi Michael_Wojcik,

 

I use the latest Version of Net Express V 5.117.0014.

I have also reported this to the support line #3200140

Kind Regards,

Georg Jarzak

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: conversion from utf-8 to Windows-1252

You're using a 10-year-old product. It's possible you'll have to upgrade to something a little more recent.

You didn't answer my other questions.

0 Likes
geozak Trusted Contributor.
Trusted Contributor.

Re: conversion from utf-8 to Windows-1252

Hi Michael_Wojcik,

the latest Update of NE 5.1 was from Dez.2018.

Support line is working on that issue. Thank You.

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: conversion from utf-8 to Windows-1252

Those are fixes, not new features. You're still using a ten-year-old product.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.