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

Wrong message encoding for non-UTF systems

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            gpanov Grigory Panov

            Dates

              Created:
              Updated:

              Slack

                Issue deployment