FDK: Problem with newlines / carriage returns
Hello
I've encountered a strange issue with some strings when using the FrameMaker API. We have an FAPI client which translates FM documents by reading in their contents, replacing their text with the new translated text and writing back the changes.
However, I've found that some strings are beginning with an \r (carriage return) character when we read them in, and when we write them back out, they begin with \r\n, which moves the text down a line, and can break things like cross-references etc. I'm not exactly sure why this is happening, we're using Visual C++ and we do a lot of conversions between CStrings and StringT types so maybe that conversion process is doing it.
To be honest, I find the occurrence of newlines and carriage returns in Frame strings a bit odd as the Frame API breaks the text in a paragraph into fragments for you anyway, so I would have thought the usage of such characters is redundant. This is a big assumption though so correct me if I'm wrong.
We've implemented a work around whereby our program strips newlines out of strings before writing them back
but in reality, all we really need to do is strip leading newlines from strings, before the actual printable text in a string begins.
I'm wondering what others have to say about this approach WRT its safety. Any opinions would be appreciated, thanks
Eric
