2 Replies Latest reply: Jun 5, 2013 7:47 AM by user3114898 RSS

    Markup not displaying Doc/docx/PDF properly

    stinkylinky
      Hey everyone,

      I'm using Oracle text in conjunction with Apex, all on top of the 11G database. My issue is that using the Oracle text Markup, many files types do not display properly. The level of wrongness varies, from some readable text to complete gibberish. This happens to all version of PDFs, Docs, and Docx files. A sample of what appears is below:

      Æ
      @à°€P ðÀ!dðgd£n=gd8h²„h^„hgd8h²^
      &F
      Æ
      p@à°€P ðÀ!dðEÆ€^ZfFG·ðgd÷i+
      &F„˜þ`„˜þgd÷i+
      &F
      Æ
      pà°€P ðÀ!dðgdýOôHN”³´ÔÕûý     "#f‘ðáÕáÁ²Õ² Ž|n]L²8-h£n=h£n=CJaJ&h£n=h÷i+6B*CJ\]aJph h8h²h÷i+5B*CJaJph h£n=h÷i+5B*CJaJphh£n=5B*CJaJph#h£n=h£n=5>*B*CJaJph#h£n=h÷i+5>*B*CJaJph#h8h²h÷i+5>*B*CJaJphh8h²h÷i+B*CJaJph&h8h²h÷i+6B*CJ\]aJphh£n=B*CJaJphh£n=h÷i+B*CJaJphh£n=h£n=B*CJaJph´üý#â„_B
      &F

      However, using a simple .txt file, the result is nearly perfect and everything is complete readable.
      create or replace PROCEDURE test
           (p_id      IN VARCHAR2,
             p_query   IN VARCHAR2)
          AS
            v_clob         CLOB;
            v_read_amount INTEGER := 32767;
            v_read_offset INTEGER := 1;
            v_buffer      VARCHAR2 (32767);
          BEGIN
              
              htp.p('<b>HTML version with highlighted terms</b>');
           CTX_DOC.MARKUP
             (index_name => 'DOCUMENTS_INDEX',
               textkey    => p_id,
               text_query => p_query,
               restab     => v_clob,
               starttag   => '<i><font color=red>', 
               endtag     => '</font></i>'); 
          
           LOOP
              BEGIN
                  dbms_lob.read(v_clob,v_read_amount,v_read_offset,v_buffer);
                  htp.p(v_buffer);
                  v_read_offset := v_read_offset + v_read_amount;
                  v_read_amount := 32767;
              EXCEPTION
                WHEN NO_DATA_FOUND THEN EXIT;
              END;
           END LOOP;
         END test;
      The above is the procedure I'm using if that helps. If anyone has ideas about what's going wrong, I'd greatly appreciate it.