7 Replies Latest reply on Mar 22, 2019 11:56 AM by Vanja Keglević

    ORDS - request charset

    Vanja Keglević

      Hello,

       

      I'm having problems when issuing http requests to ORDS using charsets other than utf-8(which works fine). I tried windows-1250, iso-8859-2 and utf-16. Neither of them gets parsed correctly in ORDS, for non ascii charaters I get "?" charaters.

      Does ORDS handle properly charsets other than utf-8?

       

      Thanks

        • 1. Re: ORDS - request charset
          thatJeffSmith-Oracle

          ORDS is Java which by definition is pure Unicode

           

          Do you have an example? Those always help. And I assume you are looking at the raw data returned and not how your client/viewer/browser is choosing to render said responses?

          • 2. Re: ORDS - request charset
            Vanja Keglević

            Jeff,

             

            I'm a Java developer so I know that charset should and can be handled correctly. But it's certainly not handled "by default" in Java.

            My issue is only with the charset of the request, not with the ORDS response.

            I don't have an example, but could try to make one on apex.oracle site.

            • 3. Re: ORDS - request charset
              thatJeffSmith-Oracle

              no need for that, just share your request, and describe what the handler code is doing

               

              for example i already have an ECHO service, i could test that to see if i could send a 'funny character' and get it back correctly, but I'd rather not guess what you're doing/seeing

              • 4. Re: ORDS - request charset
                user11981878

                Gentlemen,

                 

                I'm also struggling with encoding in ORDS.

                My database is in MSWIN1252 and exposes data through ORDS.

                As far as my knowledge goes, ORDS is like a java wrapper around my pl/sql.

                If my pl/sql function returns a resultset with eg french characters inside (éëè...) the response of my request shows me other characters eg:

                value: FÖRSTERÖË

                becomes:FÖRSTERÖÃ

                (request property "Encoding" in soapui not specified)

                I'm using SOAPUI to test my request

                if I explicitly set my request property "Encoding" in soapui to UTF-8 I get the correct value.

                I also wonder which language setting is used when connecting from java layer to database (NLS_LANG?)

                 

                Thnx

                Grts

                Stijn

                • 5. Re: ORDS - request charset
                  Vanja Keglević

                  Jeff,

                   

                  here is an example:

                   

                  ORDS plsql handler("request" variable is an out response string):

                  declare

                      v_request   clob;

                  begin

                      v_request := :body_text;

                      :request := v_request;

                  end;

                   

                   

                  ### First I try posting string abcčšćđž in utf-8, and it works as expected:

                  $ echo -e '\x61\x62\x63\xc4\x8d\xc5\xa1\xc4\x87\xc4\x91\xc5\xbe' | curl http://lldevapex:8080/ords/lldev/opp/test/encoding --user "tomcat_ords:tomcat_ords" -H 'Content-Type: text/plain; charset=utf-8' --data-binary @-

                  {"request":"abcčšćđž\n"}

                   

                   

                  ### Then I try the same request and just change the charset to iso-8859-2 in the request - string gets parsed again as utf-8?

                  $ echo -e '\x61\x62\x63\xc4\x8d\xc5\xa1\xc4\x87\xc4\x91\xc5\xbe' | curl http://lldevapex:8080/ords/lldev/opp/test/encoding --user "tomcat_ords:tomcat_ords" -H 'Content-Type: text/plain; charset=iso-8859-2' --data-binary @-

                  {"request":"abcčšćđž\n"}

                   

                   

                  ### Then I try to send a string in iso-8859-2 encoding - but it doesn't get parsed right:

                  $ echo -e '\x61\x62\x63\xe8\xb9\xe6\xf0\xbe' | curl http://lldevapex:8080/ords/lldev/opp/test/encoding --user "tomcat_ords:tomcat_ords" -H 'Content-Type: text/plain; charset=iso-8859-2' --data-binary @-

                  {"request":"abc???\n"}

                  • 6. Re: ORDS - request charset
                    thatJeffSmith-Oracle

                    Java should be translating that to utf-8 for us, automagically. Before I start a test case/bug report, what version of Java you running?

                    • 7. Re: ORDS - request charset
                      Vanja Keglević

                      Java version is:

                      java version "1.8.0_191"

                      Java(TM) SE Runtime Environment (build 1.8.0_191-b12)

                      Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

                       

                      tomcat-9.0.13

                      Oracle Database 11.2.0.4.0

                      > select ords.installed_version from dual;

                      INSTALLED_VERSION

                      --------------------------------------------------------------------------------

                      18.4.0.r3541002