writing to file trouble - Adobe Indesign

This is a discussion on writing to file trouble - Adobe Indesign ; Hi, i'm having a problem trying to write text to a plain-text file. the thing is that the script works fine if there are no 'weird' characters in the text (in my case, Lithuanian characters). any clues? part of the ...

+ Reply to Thread
Results 1 to 5 of 5

writing to file trouble

  1. Default writing to file trouble

    Hi,

    i'm having a problem trying to write text to a plain-text file. the thing is that the script works fine if there are no 'weird' characters in the text (in my case, Lithuanian characters). any clues?

    part of the script:

    var myFldrName = myDoc.filePath;
    var myTextName = myDoc.name.split(".indd").join("_.html");
    var myFile = File(myFldrName + "/" + myTextName);
    var fulltext = "";
    ....
    myFile.open("w");
    myFile.write(fulltext + "
    ");
    myFile.close();

    thanks for help in advance.

    Robertas

  2. Default Re: writing to file trouble

    What you need to do immediately after opening the file is set its encoding. This is described on page 541 of the InDesign CS2 Scripting Reference under File object properties/encoding with all the encoding details on page 553. Exactly which encoding you need might take some experimentation.

    Dave

  3. Default Re: writing to file trouble

    thank you Dave. but i only have InDesign Scripting Guide :/

  4. Default Re: writing to file trouble

    Which version of InDesign are you using? If CS, look in that guide in the JavaScript section under "About Files and Folders".

    Dave

  5. Default Re: writing to file trouble

    utf8 has helped. once again, thank you Dave

+ Reply to Thread

Similar Threads

  1. secure file writing (escaping characters from the file name)
    By Application Development in forum RUBY
    Replies: 5
    Last Post: 09-12-2007, 02:29 PM
  2. trouble writing new and updated values to app.config file
    By Application Development in forum CSharp
    Replies: 6
    Last Post: 08-24-2007, 05:55 AM
  3. File reading and file writing
    By Application Development in forum Object
    Replies: 2
    Last Post: 02-23-2007, 08:25 AM
  4. Help File Writing
    By Application Development in forum Clarion
    Replies: 3
    Last Post: 04-19-2004, 09:26 AM
  5. Writing XML file
    By Application Development in forum DOTNET
    Replies: 2
    Last Post: 01-08-2004, 06:09 AM