Highlighted

Importing UTF-8 Text

Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

I am using doc.Import to import a text file into FrameMaker. The text file is encoded in UTF-8. Is there a UTF-8 Constant for importing text files in FrameMaker? Here is my function:

TTC_MB.importFile = function (filename, textLoc, doc) {
    
    var importProps, retProps, i;
    
    // Get default property list for importing documents.
    importProps = GetImportDefaultParams ();
    // Get a property list to return any error messages.
    retProps = new PropVals ();

    // Set specific import property values to import the document.
    i = GetPropIndex (importProps, Constants.FS_AlertUserAboutFailure);
    importProps[i].propVal.ival = false;
    i = GetPropIndex (importProps, Constants.FS_HowToImport);
    importProps[i].propVal.ival = Constants.FV_DoByCopy;

    // Attempt to import the document.
    doc.Import (textLoc, filename, importProps, retProps);
};

 

TOPICS
Scripting

Views

38

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Importing UTF-8 Text

Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

I am using doc.Import to import a text file into FrameMaker. The text file is encoded in UTF-8. Is there a UTF-8 Constant for importing text files in FrameMaker? Here is my function:

TTC_MB.importFile = function (filename, textLoc, doc) {
    
    var importProps, retProps, i;
    
    // Get default property list for importing documents.
    importProps = GetImportDefaultParams ();
    // Get a property list to return any error messages.
    retProps = new PropVals ();

    // Set specific import property values to import the document.
    i = GetPropIndex (importProps, Constants.FS_AlertUserAboutFailure);
    importProps[i].propVal.ival = false;
    i = GetPropIndex (importProps, Constants.FS_HowToImport);
    importProps[i].propVal.ival = Constants.FV_DoByCopy;

    // Attempt to import the document.
    doc.Import (textLoc, filename, importProps, retProps);
};

 

TOPICS
Scripting

Views

39

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 19, 2020 0
Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

Knowing nothing about this, is doc.Import an FM FDK API?

If it's an analog of the File > Import command, I'd expect it to have options for Copy-In v. By-Reference, and some vague spec for object type.

And on that, I note that the command, for Text, only specifies "Text", and does not resolve to codeset.

UTF-8 BMP v. SMP would of course also potentially arise.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 19, 2020 0
Adobe Community Professional ,
Nov 20, 2020

Copy link to clipboard

Copied

Hi Bob, Yes, but when you choose Text in the interface and go to the next dialog, you can specify the encoding. There are FDK/ExtendScript import settings for all of the entries except the UTF entries.

 

frameexpert_0-1605888195020.png

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 20, 2020 0