英文:
ActiveMQ REST DELETE call unable to read multibyte characters
问题
我正在使用Apache ActiveMQ 5.16,并尝试通过ActiveMQ Web控制台发送包含多字节字符的数据(例如 日一国会ABC
)到一个队列。我使用CURL调用来读取数据,但响应中的数据为 ????ABC
。有人能指出可能的问题吗?
ActiveMQ Web控制台中的数据:
curl
调用:
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"
响应:
英文:
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:
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:
答案1
得分: 0
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 https://stackoverflow.com/questions/31804805/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
英文:
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 https://stackoverflow.com/questions/31804805/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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论