Friday, June 14, 2013

EventSource's response has a charset ("iso-8859-1") that is not UTF-8. Aborting the connection Error

SERVER SENT EVENTS, HTML5 AND TOMCAT 7

If you test, you can understand that there is no problem while running the project with Tomcat 6.

Yes, the problem is with Tomcat 7. It supports charset : iso-8859-1 by default.
So, we need to fix this problem with describing that we are using character encoding(charset)  UTF-8.

Change the responce.setContentType as follows:

response.setContentType("text/event-stream, charset=UTF-8");


Thats it.

4 comments:

  1. That worked Seamless...thanks a ton.
    you saved my day

    ReplyDelete
  2. Thank you for the wisdom and insight your blog imparts – it's like having a wise mentor guiding me along the way! Join the Retrobowl Unblocked revolution and take your football skills to new heights!

    ReplyDelete