8 Replies Latest reply on Jun 18, 2009 7:58 AM by Andreas Jansson

    What's character 65279 all about?

    Andreas Jansson Level 2

      Under circumstances I'm not quite sure of. (I do set styles, autotag and map styles/xml, and also use duplicate on some occation). Anyway there are these extra characters added, with charCode 65279, and once they are there I can't seem to get rid of them.

       

      I attach an image of my debugging here:

      Untitled-1.png

       

      Positions 10, 11, 15 and 16 contain the same 65279-code.

       

      What does this mean in InDesign? I found someone stating that they are "Zero Width No-Break Space", but I'm not sure that's true, or if so, what's the meaning of them, and how can you replace them?

       

      They get converted into spaces when I extract the contents and use it in a client application, and the next time two new spaces are added, that's why they are disturbing to me. The best thing would be if I could prevent them from appearing in the first place, or if they can be removed when reading the data.

       

      Any ideas?

       

      Best regards,

      Andreas

        • 1. Re: What's character 65279 all about?
          Harbs. Level 6

          Those are xml tags. They a re always paired. The only way to get rid 

          of them (if you want to), is to untag the text, or select both the 

          opening and closing tags together and delete.

           

          Harbs

          • 2. Re: What's character 65279 all about?
            Harbs. Level 6

            Here's what tags look like when they are visible...

            00000049.png

            1 person found this helpful
            • 3. Re: What's character 65279 all about?
              Andreas Jansson Level 2

              I checked this, but the text that I have is not tagged - no coloured brackets displayed when switching "view tag markers" on. But the origin of the text was indeed tagged, on those exact places which are now char 65279.

               

              So it seems that the "duplicate" method I use on the original text does not remove the xml markers completely. The text gets dplicated with styles and all (duplicated from a table cell into a text frame).

               

              I made a quick test which you can see below:

               

              1. draw a text frame and enter some text. Set parts of it to any tag(s).

              Untitled-1.png

               

              2. Select the text frame and run the code below:

               

              var newTf = app.activeDocument.textFrames.add({geometricBounds:[0,0,100,100]});
              app.selection[0].texts[0].duplicate(LocationOptions.UNKNOWN, newTf);
              $.writeln (newTf.contents);

               

              Untitled-2.png

              The result was a new text created with the contents of the first one. The new one is not tagged, but still carries the start- and end markers, as the contents property shows.

               

               

              -- Andreas

              • 4. Re: What's character 65279 all about?
                Harbs. Level 6

                I responded by email earlier, but it didn't show up...

                 

                I've never tried to duplicate tagged text, so I can't comment on what you're seeing.

                 

                A few thoughts though:

                 

                1) What happens when you first tag the story that you're duplicating the text to. Does that copy the text with the tags intact?

                 

                2) You might want to look into duplicating the xml elements instead of the text.

                 

                Harbs

                • 5. Re: What's character 65279 all about?
                  Harbs. Level 6

                  I've never tried to duplicate tagged text, so I can't comment on what 

                  you're seeing.

                   

                  A few thoughts though:

                   

                  1) What happens when you first tag the story that you're duplicating 

                  the text to. Does that copy the text with the tags intact?

                   

                  2) You might want to look into duplicating the xml elements instead of 

                  the text.

                   

                  Harbs

                  http://www.in-tools.com

                  Innovations in Automation

                  • 6. Re: What's character 65279 all about?
                    [Jongware] Most Valuable Participant

                    I use duplicate to copy selected parts of chapters into a manually constructed Table of contents, and yes: I see the same behavior. They are not really "tags" anymore, they do not show up in the XML panel. I never tried re-tagging then un-tagging, but I don't think that'll work since they aren't XML tags anymore ...

                    So after copying everything needed, I kill them off with

                     

                    app.findTextPreferences.findWhat = "<feff>";
                    app.changeTextPreferences.changeTo = "";
                    toc_dest.parentStory.changeText (false);

                    1 person found this helpful
                    • 7. Re: What's character 65279 all about?
                      Andreas Jansson Level 2

                      I was already done with a workaround, digging up the xml reference of the cell text I was duplicating (which was not easy since the associatedXMLElement returns null for merged cells - see another message thread about that) and then untagging the source text to get a clean duplicated text. Since it was styled, the tags could be restored afterwards - but this kind of workaround code is not quite good.

                       

                      I had already tried copying the XML instead (your n:o 2), but the duplicated xml structure was not returned properly - the reference to the xml element of the duplicated structure showed the right contents, but running .select() on it, it selected another cell in the same table as the xml source. Tried to move the duplicated xml to a certain known place (last under root or something like that) but was not successfull in that - and that would have been as much a workaround as the solution above.

                       

                      So I tested your

                      1) I called .autoTag() on the empty text frame I was duplicating "to", and that made me end up with a correctly tagged and copied piece of text from the cell!

                       

                      This will be the current solution. Thank you for all help!

                       

                      Midsummer weekend greetings to you all!

                       

                      Andreas Jansson

                      • 8. Re: What's character 65279 all about?
                        Andreas Jansson Level 2

                        Jongware: Thanks for you answer too! It was not possible to use untag() since InDesign did not consider the text as tagged, but your find and replace suggestion could have made as good a solution as Harbs's. Thank you.