Ok, this one really is weird.

I am converting files to different formats. The data
contains DBCS data and SBCS data.

We got past the point of making a plain text or .doc file
working (.doc being basically a plain text with CRLF for
the lines).

Now we're doing PDF. Which technically should make zero
difference.

We read the data in (a line of text), then write it out to
a stream file using the write() API.

When it hits the line with the DBCS data in it, it just
freaks out and starts writing garbage to the file.

The ONLY difference in the text we're writing out is it is
enclosed in ( and ) ends with a single quote.

I checked the data right before the Write(), checked the
length it was passing in, and everything is fine! It
writes 12 lines before this one just fine, but once it hits
the DBCS data, boom.

Makes no sense to me. It is PDF data, but it's really
"just plain text". And all data after it, even straigh
SBCS data is also garbage.

The only thing I could find was the hex value for the line
that it starting bombing out on, instead of writing the
real data, it was x'FEFE'

The only thing I can think of here is a bug in the OS with
the write() API.

Anyone else seen anything like this, or have any ideas?

So:

eval Data = 'This is DBCS Data'

if I write just Data, it is fine, even the DBCS data.

If I do:

eval Data = '(' + %trimr(Data) + ') '''

It starts writing just garbage.. and not even the same
length of string garbage.

Argh [pulling hair out]

Thanks in advance!