Reputation: 1505
I have a jsp, I draw a set of charts in which it is collecting live data from Twitter. Am displaying the usernames from Twitter. It has all different languages from all over the world. The names even has many different fonts. I need to display As it is. But my webpage Shows like its not supported and it displayed as ?????
or ����
I got some solutions like adding
<meta name="http-equiv" content="Content-type: text/html; charset=UTF-8"/>
<meta name="http-equiv" http-equiv="Content-type" content="text/html;charset=ISO-8859-1">
<meta name="http-equiv" http-equiv="Content-type" content="text/html;charset=BIG5 ">
But Still No improvement. I am using Spring MVC for my Web application
I have also added bean referring this link
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages"/>
<property name="defaultEncoding" value="UTF-8"/>
</bean>
Still I have the same problem. Can anyone figure out any solution.. Thanks In advance
Upvotes: 1
Views: 3751
Reputation: 13714
It's not so straight forward, there's some server configuration required for this support.
Not only that, make sure utf-8 is your IDE's default and also the default for jvm.
How to get UTF-8 working in Java webapps?
Above answer explains it completely, and since it itself is a SO answer, I guess the link won't get dead or changed.
Upvotes: 1
Reputation: 12538
Well that is a browser-side setting. You should set it on the server side directly in the headers.
Put the following in your jsp as the first line:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
Upvotes: 2