A computer system and object-oriented method and class for use with the
computer system to convert data in Unicode format back and forth to data
having a fixed-length format, such as EBCDIC, and to allow editing of the
data and return the edited data back to its original format without loss
of bytes. Conversely, the method, class, and computer system also allow
the downloading of data in a fixed-length format into a Unicode
environment, the fixed-length format is converted into an editable form
and then reconverted back into the fixed-length format without loss of
bytes. The method accommodates UTF-8, UTF-16, and UTF-32. Once the
fixed-length of the data has been determined, a byte array is created and
an attribute indicating whether a character is a single byte character or
a double-byte character is assigned to each byte in the array. The array
and subset arrays representative of fixed-length fields within the
fixed-length statements may then be truncated, and/or repaired at either
or both the beginning and the end, and/or right- or left-aligned to
realize a version of the data that can be displayed and edited without
loss of bytes. Once edited, using the assigned attributes, the byte array
can be converted to code having the fixed-length format or can be
translated back to Unicode.