[LIKE, CS4] Import and export text file that contains the tag: encoding problem

Hello

I have a script that exports a text selection into a temporary folder (Unicode) text file with label. This file is then loaded in a variable AS and transformed line-by-line for some changes to the text. Subsequently a new text file with the modified content is written.

Up to CS2 (and 10.4 PPC) this script worked like a charm. He stopped working with the new system and Intel. Meanwhile, I discovered that it must have something to do with encoding problems. «Everything in the old writing with ' as a unicode text "forced a mistake (since AS 2 each text is processed as UTF - 16), so I changed these lines to ' as text '.»

In addition, I realized, that InDesign exports to tag text Unicode like UTF-16 (little endian), but importing tagged text to UTF-16BE (big-endian). "As variables and" write iconv ' command uses MACROMAN, so I added a few conversions with ""and it worked.

Unfortunately the last conversion of MACROMA in UTF-16BE converts all spaces in the output string en normal spaces.

I am therefore a little at my end of the problem. Can someone help me please?

See you soon

Tobias

[InDesign 6.0.4 with AppleScript on Mac OS v2.0.1 X 10.5.8, Intel]

A code for the relevant parts:

Export as referenced text selection:

on TMPexportTaggedText(myFileName, myText, myEncoding)
    tell application "Adobe InDesign CS4"
        tell tagged text export preferences
            if myEncoding = "ascii" or myEncoding = 1 then
                set character set to ASCII
            else if myEncoding = "ansi" or myEncoding = 2 then
                set character set to ansi
            else if myEncoding = "unicode" or myEncoding = 3 then
                set character set to unicode
            else if myEncoding = "jis" or myEncoding = 4 then
                set character set to shift JIS
            else if myEncoding = "gb" or myEncoding = 5 then
                set character set to GB18030
            else if myEncoding = "ks" or myEncoding = 6 then
                set character set to KSC5601
            else
                set character set to ansi
            end if
            set tag form to abbreviated
        end tell
        export myText format tagged text to (myFileName) without showing options
    end tell
    tell application "Finder"
        try
            do shell script "iconv -f UTF-16LE -t UTF-16 " & (POSIX path of myFileName) & " > " & (POSIX path of myFileName) & "1"
            set myFileName to myFileName & "1"
        end try
    end tell
end TMPexportTaggedText
 

Line and placement in InDesign (circleLines not the textual changes and throw a string with):

set theOutput to my circleLines(IN_File & "1", myOptions)
    
if theOutput ≠ "" then
  tell application "Finder"
    open for access file (OUT_File & "1") with write permission
    write (theOutput) to file (OUT_File & "1")
    close access file (OUT_File & "1")
    try
       do shell script "iconv -f MACROMAN -t UTF-16BE " & (POSIX path of (OUT_File & "1")) & " > " & (POSIX path of OUT_File)
       do shell script "cat " & (POSIX path of OUT_File) & " | tr '\\n' '\\r'"
    end try
  end tell
end if
    
place (OUT_File) on curSel without showing options

 

The string output with

    write (theOutput) to file (OUT_File & "1") as unicode text
an error of InDesign (bodychecking).

The problem is not as long as ID's export is little-endian - someone ' one has not heard of Intel chips - but it does not add a byte order mark. If you add a BOM, the problem should go away. Here's how you can add a Bill adapted to an exported file to tag:

the fileRef value (open for access file "Macintosh HD:Users:shane:Desktop: Untitled - 16.txt" with write permission)

the value of x to read fileRef

Set x to character id {711, 731} & x - add THE BOM

write x to fileRef starting with 0

FileRef close access

Then you can read it using "text Unicode", and it should also cross-platform very well.

And stop putting your file read/write inside blocks Finder - is not the business of the Finder.

Tags: InDesign

Similar Questions

  • How can I import and export MBOX files in Thunderbird?

    Hi all, how can I import and export MBOX files in Thunderbird?

    I tried to install the add-on "ImportExportTools" but it seems that it is no longer recognized by Thunderbird, not the most recent generation.

    That this is the case, is no longer seems to be any official method of handling the files MBOX via Thunderbird, which is odd, given that Thunderbird itself announces that it is method of storage of email records is also MBOX files. It seems obvious that Thunderbird should natively support a file format import and export it is used internally

    If you know of a solution that does not rely on the conversion of traditionally third party utilities little reliable, please let me know.

    Thank you, KB_IT

    Hi there and thank you. I got it on 45.2.0.

    "" I haven't managed to make it work, but only by the search for available modules and following a request from 'import export tools' the "see all results" that work only then produced a success for the plugin in question and showed a button to install it.

    Installers hosted on the site of the third party do not work, nor their instructions to use the option "install file". work, which led to the creation of this ticket.

    Since then, I was able to do properly installed where it works very well.

    I hope that they are a regular feature. I intend to announce this as a best practice to my organization, in collaboration with Google fish, during the handling of the mbox files in Windows operating system.

    Thanks again, Kevin

  • I have a pdf file that contains the text if I copy all the text and paste it into Notepad and save the .txt file is it changes the ascii value of the text?

    I have a pdf file that contains the text if I copy all the text and paste it into Notepad and save the .txt file is it changes the ascii value of the text?

    If the encoding is ASCII? Laughing out loud

    Be well...

  • Where does FireFox get the default value for a preference of. What is the format of the file that contains the default value?

    Where does FireFox get the default value for a preference of. What is the format of the file that contains the default value? I need the actual default value for an individual preference.
    Topic: config shows some default values, but I need the source from which everything: config returns to the default value.
    Any help in this direction is greatly appreciated.

    User Agent

    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x 64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    The preferences that are not hidden if they have by default are stored in two JavaScript text files in the Firefox program folder
    You can open them in a tab in Firefox through these links:
    resource:///defaults/pref/firefox.js
    resource:///greprefs/all.js

    (702598/forum/1/702598)

  • Windows 7 is not find all files that contain the phrase that I have sought in their name

    I am looking for files with a certain expression in name. When I type top-right search gives me some files with this phrase in their name and then I cut them in the file. But when I go in the file I searched, I still see a lot of files that contain this phrase in their names that do not appear in the search.

    Hello

    1 did you change on your computer?

    2 did you receive an error message?

    Method 1:

    I suggest you run the fixit tool and check.

    Difficulty of Windows Desktop Search when it hangs or no display of results

    http://support.Microsoft.com/mats/windows_search/en-us

    Method 2:

    I also suggest you to see link and check.

    Open the troubleshooter for search and indexing

    http://Windows.Microsoft.com/en-us/Windows7/open-the-search-and-indexing-Troubleshooter

    See also:

    Improve Windows searches using the index: frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows7/improve-Windows-searches-using-the-index-frequently-asked-questions

  • Can load us a file that contains the joint field delimiter

    Hi guru,.

    Can load us a file that mixed the field delimiter

    EX: -.

    My first 10 lines have as field separator «,»

    from 11 to 20 lines have as field separator «;»

    from 21 to 30 lines have field as separator ' | '.


    123456789
    ABC, def, xyz
    a1d2 | b1cw | xedr23

    Hello

    If you have a special field that allows to identify the differences between these lines, you can use it to create 3 ODI data warehouses.
    Each data store refers to the SAME resource (ie: same file), but you use the option called "REGISTRATION CODE" to differentiate.

    ex: I will add a field 4th on your land, which I will call "block".

    123456789; Block1
    ABC, def, xyz; bloc2
    a1d2 | b1cw | xedr23; bloc3

    I create 3 warehouses of data based on this file.

    First data store: I define ',' as the delimiter
    Second data store: I define ';' as delimiter
    Third-party data store: I define ' | ' as delimiter

    In the properties of the column of the first store of data block, I put 'Block1' value in the 'registration code '.
    In the properties of the column for the second data store block, I put the "bloc2" value in the "registration code".
    In the properties of the column of the third-party data store block, I put the "bloc3" value in the "registration code".

    I think it should work.

  • How can I get more results that contain the tag/bookmark appears in the awesome bar? Currently, it will show only 4.

    When I type a word in the address/url/awesome bar it's a word that I know that I used as a tag on several pages of a bookmark, only 4 results in the menu drop-down are marked pages of a bookmark. The rest of the pages in the menu drop-down are other pages available on the web. Because only 4 results are pages I tagged, the page I want to (and scoring) often does not appear. Is there a setting I can change to make it show more results? Or is there a way once I get the original results to add extra elements containing the tag / my favorites?

    This may be a problem with the Fastestfox extension.
    See Troubleshooting extensions and themes and problems of hardware acceleration to resolve common Firefox problems

    In the FastestFox Options, uncheck the 'Awesomebar improving '.

    See the 10 image in the image gallery: https://addons.mozilla.org/firefox/addon/9825

    https://addons.Mozilla.org/IMG/uploads/previews/thumbs/37/37975.PNG

  • ' Inferior to ' sign in InDesign that contains the tag Text

    I use Filemaker to build the text marked for InDesign, but I get an error when the text contains a < (or even a >) sign.

    Does anyone know what combination of characters that I should replace this ID so will see this for what it is, not as a tag opener/closer? Quark was <------<>but InDesign is not satisfied either.

    Thank you

    Emma

    Just type 'Test test' in a framework and export that yields

    Test \ test
    

    and his reading in ID gives the desired result.

  • Hey, newbie here. I'm trying to copy and paste a file that contains text.

    I need to make a sheet of labels in this file, but it won't paste the text as the background. What I am doing wrong?

    Are you sure that the text is selected, it may be a locked object or layer. Use the technique below as a test. Hide is a good friend in Illustrator, even after you become comfortable with the interface.

    1. Select > all
    2. object > hide > selection
    3. object > show all

    The other major reason that can happen is you can paste the text, but it's somewhere off the screen. Zoom out and do a select all in order to see if you can find the text.

  • Cannot import and export MPEG2 files in After Effects and Premiere Pro.

    I don't know when, but a few days ago my Premiere Pro and Adobe After Effects do not recognize the MPEG2 files.

    When I try to open a Premiere Pro with a MPEG2 file in it: "this project contained a sequence that could not be opened. There be no preview sequence preset or codec file associated with this type of sequence.

    FAQ: Why some codecs and sequence presets missing my Premiere Pro installation?

  • I would like to import a psd - 3D file. Lack the 'Live Photoshop 3D' - field in the import window.

    I got a 3D (3ds) file. I want to animate it.

    In Photoshop, it all the layers and the gfx is perfect.
    Record of.

    When you import the file into After Effects, I should chose "Live Photoshop 3D", but it is not possible.
    This should be a plugin etc, Add on.
    Anyone know how to get... ?

    What version of AE do you have? If you have CC or CC 2014 (versions 12 and 13 respectively), you can use Cinema 4 d to make it. Cinema 4 d Lite comes free with After Effects! Details of the CINEMA 4 d integration with after effects CC

  • I deleted a file that contains the entire set up of the files. Now my phone will not work. Help, please.

    Original title: re - install

    Hi, can anyone help? I use Vista Home Premium on a Toshiba laptop.

    Recently, I deleted a file from D: drive (which has a system set up files etc.). I received a message that "Auto back up had no" and I tried System Restore etc, but nothing worked. I then ran Chkdsk and this allowed Auto back up to go back to my external HARD drive. After Auto save, I checked the drives and horrors, D: drive was full and in the RED.

    I tried the F8 recovery console, but when I tried "Recovery system" (which keeps intact all my files and settings), I was informed that there were "no back ups on the computer '." I tried to use back ups of my external HARD drive, but nothing, still got the same message. In the same Message window, it asked me to insert an of my previously recovery disks. I tried two discs, but got the same message as before.

    My computer works always, but with a drive D: saturated, but if I do a full re-install, the computer back to its original state, I have to make copies of all my data (info from year 8) backup, or that I can then re - install the files on my external HARD drive?

    Follow the steps mentioned in the given article

    http://www.ehow.com/how_5108136_restore-Windows-system-files.html

  • Insertion of text records that contain the '&amp; '.

    Hello
    I'm you insert records in my table in the field NAME (varchar2) PLACES, and the record that I'm trying to insert is as "Barrie & District Park. I didn't know if I wrote my statement correctly.

    Update SITES
    name = q '(Barrie & District Park)' where...;

    Thank you!

    Try:

    SET DEFINE OFF

  • Need location of the .jar file that contains the following classes.

    import com.bea.wli.config.Ref;
    import com.bea.wli.sb.management.configuration.ALSBConfigurationMBean;
    import com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean;
    import com.bea.wli.sb.management.configuration.SessionManagementMBean;
    import com.bea.wli.sb.management.query.ProxyServiceQuery;

    Published by: user10956573 on March 31, 2011 23:01

    import com.bea.wli.config.Ref;

    $MW_Home/Oracle_OSB1/modules/com.bea.common.configfwk_1.5.0.0.jar

    import com.bea.wli.sb.management.configuration.ALSBConfigurationMBean;
    import com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean;
    import com.bea.wli.sb.management.configuration.SessionManagementMBean;
    import com.bea.wli.sb.management.query.ProxyServiceQuery;

    $MW_Home/Oracle_OSB1/lib/sb-kernel-api.jar

    Kind regards
    Anuj

  • Import and export in linux.

    Hello

    can someone guide me how to import and export dump files in Red Hat linux 5.2?
    also, I searched the Internet, but I couldn't because I'm newbie to linux.
    can someone help me and guide me step by step?
    I've also posted on the general database, but I just got links here.
    can someone guide me step wise?
    I am newbie to linux.

    I tried the following commands.

    system/pass@db imp file $ = file_name log = log_name full = y
    but he gave me a new problem, something like that.

    export-import >
    I did not understand that the above.

    Thanks in advance.

    Sarah

    Published by: QGIRCO on April 27, 2010 04:58

    Unfortunately, based on what you have provided and what I read on your other post that you probably won't get many more links on this forum as well. The documentation is pretty clear on how to use IMP / EXP.

    Were you able to follow the documentation and the examples given? You mentioned on your other thread that you know how to do it in Windows. Well the same logic applies in Linux except maybe the path to your files and permissions.

    In addition, in the future please don't double post (even on forums).

Maybe you are looking for