curlutf-8jettyactivemq-classicmultibyte-characters

ActiveMQ REST DELETE call unable to read multibyte characters


I'm using Apache ActiveMQ 5.16 and simply trying to send data with multibyte characters (e.g. 日一国会ABC) to a queue using ActiveMQ web console. I'm using CURL call to read the data but response has data as ????ABC. Can someone point me to what might be the issue?

Data in the ActiveMQ web console:

enter image description here

curl call:

curl -X DELETE \
  -H "Accept: application/json" \
  -H "Content-Type: application/json; charset=utf-8" \
  -u username:password \
  "http://localhost:8161/api/message/standalone.source.queue"

Response:

enter image description here


Solution

  • The issue is activemq uses jetty internally which by default forces encoding as ISO-8859-1 for the calls. Because of this the characters are not encoded properly. As a fix rebuilt jetty-http jar by setting encoding to UTF-8 and place it at the existing jar's location of activemq. It should work!!!.

    Check the answer of Timmmm from this post Jetty response character encoding.

    If someone knows how to fix it using some application property or web.xml attribute, please do share in comments. Tried multiple options but nothing worked