title: Displaying UTF-8 characters in PDF
body: <p>I am trying to display a PDF by converting it into a binary string from the backend.
  This is the ajax call I am making</p>
  
  <pre><code>    $.ajax({
          type : 'GET',
          url : '&lt;url&gt;',          
          data : oParameters,
          contentType : 'application/pdf;charset=UTF-8',
          success : function(odata) {
  
              window.open("data:application/pdf;charset=utf-8," + escape(odata));
  </code></pre>
  
  <p>}
  });</p>
  
  <p>When I try to open the PDF in a new window, the url looks like</p>
  
  <blockquote>
    <p>data:application/pdf;charset=utf-8,%25PDF-1.3%0D%0A%25%uFFFD%uFFFD%uFFFD%uFFFD%0D%0A2%200%20obj%0D%0A/WinAnsiEncoding%0D........</p>
  </blockquote>
  
  <p>As you can see, it uses "WinAnsiEncoding" to display the PDF. Because of this, some of the characters are not being displayed properly. How do I change this to UTF-8?</p>
  
  <p>EDIT : The backend is in ABAP. I am converting a smartform to OTF and then to a string using the function module "CONVERT_OTF".</p>
  
  <pre><code>           CALL FUNCTION fname
           EXPORTING
             user_settings      = space
             control_parameters = ls_ctropt
             output_options     = ls_output
             gv_lang            = lv_lang
           IMPORTING
             job_output_info    = ls_body_text
           EXCEPTIONS
             formatting_error   = 1
             internal_error     = 2
             send_error         = 3
             user_canceled      = 4
             OTHERS             = 5.
  
  CALL FUNCTION 'CONVERT_OTF'
            EXPORTING
               format                = 'PDF' 
            IMPORTING
             bin_filesize          = ls_pdf_len
             bin_file              = ls_pdf_xstring
            TABLES
               otf                   = ls_body_text-otfdata
               lines                 = lt_lines
             EXCEPTIONS
               err_max_linewidth     = 1
               err_format            = 2
               err_conv_not_possible = 3
               err_bad_otf           = 4
               OTHERS                = 5.
     CALL METHOD server-&gt;response-&gt;set_header_field( name = 'Content-Type'
       value = 'application/pdf;charset=UTF-8' ).
     CALL METHOD server-&gt;response-&gt;append_data( data = lv_pdf_string
       length = lv_len ).
  </code></pre>