2 Replies Latest reply: Feb 14, 2013 7:50 AM by Joe Upshaw RSS

    Problem with characters encoding

    918670
      Hi to all.

      I'm trying to create page for file download as described Generate XML FILE FROM APEX. Now I have following problem: I open created file (csv report) with MS Excel. Excel works with win1251 encoding, but file contains unicode characters. As result I see unreadable symbols.
      NLS_CHARACTERSET during report generation is CL8MSWIN1251, language in application properties is 'Russian'. As I understand, file is generated in win1251 encoding and is changed somewhere else, maybe on web server.
      In the same time, standard csv reports (from reports and interactive reports) are generated in correct encoding (win1251).
      How can I create files in required encoding?

      Versions: oracle - 11g, APEX - 4.2.1.
        • 1. Re: Problem with characters encoding
          Joe Upshaw
          You need to specify the characterset encoding in the file itself, e.g.
          ...
          OWA_UTIL.MIME_HEADER( 'text/html',  False, 'UTF8' );
          HTP.P( 'Content-Disposition: attachment; filename=' || ls_DefaultFileName );
          OWA_UTIL.HTTP_HEADER_CLOSE;
          
          HTP.HTMLOPEN;    
          HTP.META( 'Content-Type',  null, 'text/html; charset=utf-8' );           
          HTP.TITLE( ls_RiskMatrixTitle );  
          HTP.BODYOPEN;
          HTP.STYLE(:P45_RISK_SCENARIO_MATRIX_STYLE);
          HTP.P(ls_RiskMatrixTitle);
          HTP.P(ls_RiskMatrixHTML);
          ...
          -Joe
          • 2. Re: Problem with characters encoding
            Joe Upshaw
            Notice that, unlike the post you refer to, my sample explicitly sets the charset both in the mime header and the doc (the UTF8 stuff).

            -Joe