We're sending "foreign data" (from a different language) from a RPG program to a Java program but some of the data isn't coming in properly. The RPG program is currently running on an iSeries machine and Java is through a remote method invocation.
The data is received by the Java program in logical order. We process it though Java's Bidi class to get it in a visual order (since we're writing it for PDF). Most of it is okay except for a few lines with equations.