10 Replies Latest reply on Dec 4, 2016 7:11 AM by Pickory

    Text Find/Change | Syntax for two special characters <FEFF> next to each other

    Laubender Adobe Community Professional & MVP

      Hi all,

      just found an oddity with InDesign's app.findTextPreferences.findWhat concerning special characters.


      I wanted to find two special characters encoded as <FEFF> that are next to each other.

      Did that with InDesign's UI Text Find/Replace function and typed <FEFF><FEFF> in the search field.

      In my sample document there were two of them next to each other so the result was:
      one single instance.

       

      Now the scripting side:

       

      app.findTextPreferences.findWhat = "<FEFF><FEFF>";
      
      var result = app.documents[0].findText();
      alert(result.length); // 2
      

       

      "<FEFF><FEFF>" found two instances instead of one.

       

      The special characters in my sample document contain one Note object each so I could read out the Note's id number and found that indeed the two notes were found twice!

       

      My solution was to change the search string a bit:

       

      app.findTextPreferences.findWhat = "<FEFF>"+"<FEFF>";
      
      var result = app.documents[0].findText();
      alert(result.length); // 1
      

       

      That gave me the right number of results.

      Tested with InDesign CS 6 v8.1.0 and CC 2017 v12.0.0.81 on OSX 10.10.5.

       

      Did I detect a bug?

      Or should special strings always be written on their own as substrings and concatenated when working with Text Find/Replace ?

       

      Regards,
      Uwe

       

      Message was edited by: Uwe Laubender