You might look at using Microsoft Word through OLE Automation if it's available. You tell word the that document is in 1521 encoding and then do a SaveAs to a Text format.
oleobject loo_word oleobject loo_document int wdFormatText = 2 int Cryllic = 1521 int wdCRLF = 0 loo_word = Create oleobject loo_word.ConnectToNewObject ( "Word.Application" ) loo_word.Visible = TRUE loo_document = loo_word.Documents.Add() loo_document.Paragraphs.First.Range.Select() loo_document.TextEncoding = Cryllic loo_document.SaveEncoding = Cryllic loo_word.Selection.TypeText ( "This is some text." ) //([FileName], [FileFormat], [LockComments], [Password], [AddToRecentFiles], [WritePassword], [ReadOnlyRecommended], [EmbedTrueTypeFonts], //[SaveNativePictureFormat], [SaveFormsData], [SaveAsAOCELetter], [Encoding], [InsertLineBreaks], [AllowSubstitutions], [LineEnding], [AddBiDiMarks]) loo_document.SaveAs ( "This is a test.txt", wdFormatText )//, False, "", False, "", False, False, False, False, False, Cryllic, False, False, wdCRLF, False ) loo_document.Close() loo_word.Quit() loo_word.DisconnectObject() Destroy loo_word
I've set the TextEncoding and SaveEncoding of the document itself before doing the SaveAs. I believe that should be enough to make sure it ends up in the right format. You can also pass the Encoding as an argument to the SaveAs method, but PowerBuilder doesn't handle named or optional OLE arguments. Instead, you have to use positional notation and send every argument up to the one you want to pass (see the commented out lines above).