ActiveMQ REST DELETE 调用无法读取多字节字符。

huangapple go评论55阅读模式
英文:

ActiveMQ REST DELETE call unable to read multibyte characters

问题

我正在使用Apache ActiveMQ 5.16,并尝试通过ActiveMQ Web控制台发送包含多字节字符的数据(例如 日一国会ABC)到一个队列。我使用CURL调用来读取数据,但响应中的数据为 ????ABC。有人能指出可能的问题吗?

ActiveMQ Web控制台中的数据:

ActiveMQ REST DELETE 调用无法读取多字节字符。

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"

响应:

ActiveMQ REST DELETE 调用无法读取多字节字符。

英文:

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:

ActiveMQ REST DELETE 调用无法读取多字节字符。

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:

ActiveMQ REST DELETE 调用无法读取多字节字符。

答案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

huangapple
  • 本文由 发表于 2023年5月13日 20:10:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76242660.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定