Re: Progress and Java binary data interchange (now: codepages)

From: John Green

Date: 21 Jul 2006


I see what you mean about GET-STRING and code pages.

The INPUT FROM statement has the codepage CONVERT option, but:
"If the field being input is MEMPTR and your MEMPTR contains ASCII data you may
want codepage conversion. However, you cannot get conversion by using the CONVERT
parameter on the MEMPTR. You can get codepage conversion by using the MEMPTR
with the GET-STRING and CODEPAGE-CONVERT functions and the PUT-STRING
statement."

THE QUESTION:
Does this mean I can use:
 CODEPAGE-CONVERT( GET-STRING(memptr, position), cpinternal, "UTF-8")
and expect to get correct results?

I found this in the Internationalizing Applications manual:
"If two applications using different code pages communicate using sockets (one of the external programming interfaces OpenEdge provides), code-page conversion must be performed by the application. It is not performed automatically by the sockets layer. Specifically, it is not performed by socket�s WRITE() method or READ() method. 

To perform the code-page conversion, use the 4GL CODEPAGE-CONVERT function either before invoking the 4GL PUT-STRING function or after invoking the 4GL GET-STRING function."

I'm a little surprised that nobody has examples of 4gl algorithms for reading binary data from Java's ObjectOutputStream. If I get it all worked out, I'll be sure to post it somewhere for reference.


Gilles QUERRET wrote:
> A problem I faced when working with Win32 wide char libraries is that
> GET-STRING cannot be told to use a specific encoding, and this will
> also be a problem when reading from Java. I had to read strings glyph
> by glyph (unless I missed something when working with GET-STRING)
> 

On Thu, 20 Jul 2006 09:47:11 -0700, "John Green" said:
> I have a Java program that writes to a binary file using
> ObjectOutputStream, writeInt, and writeUTF.
> 
> In theory, I should be able to read that file in Progress using MEMPTR,
> GET-LONG, and GET-STRING.
> 
> That's the theory. I haven't had a chance to try it or dig into the
> details.
> 
> 
> > On Wed, 19 Jul 2006 18:46:33 -0700, "John Green" said:
> >> Has anybody used Progress's MEMPTR, GET-STRING, and GET-LONG to read
> >> binary files that were written out from Java? Any tricks or traps?
> >>