5

I wanted to search for Japanese text using the Acrobat Javascript API (search.query). Everything works fine except for the code range 0xD800~0xDFFF (Unicode surrogate code points). I have tried copy and pasting the text I want to search for into my .js file and have also tried entering the surrogate code points, in either case they appear as a "." in the search window.

Here are my questions:

  1. Why does the text appear as a dot in Acrobat?
  2. Is there any way to search for surrogates through Acrobat Javascript?

Edit: More information: In Acrobat, hit "Ctrl+J" to launch the debugger and type

search.query("\uDBCE\uDE2F", "ActiveDoc"); 

and hit "Ctrl+Enter". You should see two dots (i.e., "..") in the search window (at least with Acrobat 9). The peculiar thing is that, if you type

app.alert("\uDBCE\uDE2F");

it displays the character (a box) that I want to search for.

Ben
  • 34,935
  • 6
  • 74
  • 113
Jesse Good
  • 50,901
  • 14
  • 124
  • 166
  • 1) They appear as dots in the search window but does the search succeed in finding the character anyway? 2) Can you search for that character by copying it from Notepad and pasting it into the search box - i.e. does the search box work for that range of chars at all? – Ben Nov 10 '11 at 19:08
  • What about (2)? If you put that character into notepad, then copy and paste it into the search box, will it a) paste properly or does it show dots and b) does it find the character in the document? – Ben Nov 11 '11 at 08:54
  • 1) No it doesn't. If it did, I wouldn't have a problem. 2) Yes, you can copy it from your favorite text editor or Word and it works fine (it shows the proper character also). I think the problem is with the implementation of the `search' object in Acrobat. – Jesse Good Nov 11 '11 at 08:55
  • 3) What if you paste the actual character into the string in the debug window instead of using escape sequences? Does that work? (Trying to narrow down the problem). – Ben Nov 11 '11 at 10:09
  • I.e. if you paste this `search.query("");`? – Ben Nov 11 '11 at 12:39
  • @Ben, I appreciate trying to help, unfortunately pasting the actual character doesn't work. But, the peculiar thing is when you try `app.alert("");` it displays the character correctly. This has led me to believe the problem is with `search.query` internally. If you have any information about the guts of the Acrobat Javascript APIs, I will gladly award you the bounty :). – Jesse Good Nov 11 '11 at 22:00
  • No special knowledge, sorry! As you say it looks like a bug with the search.query method - the search dialog itself works. – Ben Nov 13 '11 at 14:03

1 Answers1

0

Have you tried entering correct pairs of surrogates? Stand-alone code units in the surrogate area don't make any sense, and can't be rendered. Nothing to with Acrobat.

Mihai Nita
  • 5,547
  • 27
  • 27
  • In Acrobat, hit "Ctrl+J" to launch the debugger and type `search.query("\uDBCE\uDE2F", "ActiveDoc");` and hit "Ctrl+Enter". You should see two dots (i.e., "..") in the search window (at least with Acrobat 9). The peculiar thing is that, if you type `app.alert("\uDBCE\uDE2F");`, it displays the character (a box) that I want to search for. – Jesse Good Oct 09 '11 at 22:32