In my spring-mvc project I want to display english language and Hindi language together.example :
Hello Sir, आप कैसे है?? (English language,Hindi language)
So,I have style.css:--
@font-face {
font-family: 'kruti dev' ;
src: url( '../fonts/k010.ttf' ) format("truetype");
}
.texts {
position: relative;
margin: 10px auto;
font-family: ' kruti dev';
}
I have "message.properties" on WEB-INF folder. message.properties is:
text = Hello Sir,
text_hi=\u0906\u092A \u0915\u0948\u0938\u0947 \u0939\u0948?
I have spring-servlet.xml
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
I am using maven,So,In Pom.xml I have:
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
In my jsp page I have:
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<section >
<spring:message code="text"/> <spring:message code="text_hi"/>
</ssection>
But the message is showing as question mark..(????).. why??
Actually gujarati,hindi etc. fonts are in utf-8 format. If you are using Hindi then in your html page following line should be there.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
But you should remove other specifications like if you are using jsp page than
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
line should be removed because you are specifying in meta tag. You need only meta tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With