Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-6635

Wrong message encoding for non-UTF systems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 5.14.4
    • None
    • STOMP
    • None
    • system where encoding not set to UTF-8 by default

    • Patch Available

    Description

      in StompConnection.java

      public void send(String destination, String message, String transaction, HashMap<String, String> headers) throws Exception {
              if (headers == null) {
                  headers = new HashMap<String, String>();
              }
              headers.put("destination", destination);
              if (transaction != null) {
                  headers.put("transaction", transaction);
              }
              StompFrame frame = new StompFrame("SEND", headers, message.getBytes());
              sendFrame(frame.format());
          }
      

      should be

      public void send(String destination, String message, String transaction, HashMap<String, String> headers) throws Exception {
              if (headers == null) {
                  headers = new HashMap<String, String>();
              }
              headers.put("destination", destination);
              if (transaction != null) {
                  headers.put("transaction", transaction);
              }
              StompFrame frame = new StompFrame("SEND", headers, message.getBytes("UTF-8"));
              sendFrame(frame.format());
          }
      

      or, at least if you use default encoding for converting here, you should use default encoding in StompFrame.format()

      Attachments

        1. StompConnection.patch
          0.2 kB
          Grigory Panov

        Activity

          People

            Unassigned Unassigned
            gpanov Grigory Panov
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: