Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8875393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:57:53+00:00 2026-06-14T18:57:53+00:00

In my Chat application I need to send message in local language. It works

  • 0

In my Chat application I need to send message in local language.

It works fine ,when trying to send a message to agent and displayed exactly it in the Customer Side.

But at agent side in displays நà¯à®à¯à®à®³à¯ à®à®ªà¯à®ªà®à®¿ à®à®°à¯à®à¯à®à®¿à®±à¯à®°à¯à®à®³à¯ for நீங்கள் எப்படி இருக்கிறீர்கள்(in english – how are you)…

In my jsp page I used,

<%@ page contentType="text/html; charset=UTF-8"%> 
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8; ">
<title>Initializer</title>
<link rel="stylesheet" type="text/css" href="css/login.css" />
<script type="text/javascript" src="javascript/login.js"></script>
</head>
<body>

<div><textarea id="textarea" rows="10" readonly></textarea></div>
<div>
<table>
    <tr>
        <td id="msg" class="fontStyle">message :</td>
        <td id="msgvalue"><input size="40" type="text" id="message"
            onkeydown="enterKey()" /></td>
        <td style="width: 5%;"></td>
        <td>
        <center><input type="button" id="button3"
            onclick="sendMessage()" value="Send" /></center>
        </td>
    </tr>
</table>
</div>
</div>
</body>

In java script,

function sendMessage(){
    clearInterval(timer);
    timer = setInterval(function(){pingAction();},5000);
    message = document.getElementById("message").value;
    document.getElementById("message").innerText = "";
    //document.getElementById("textarea").innerHTML = message;
    //alert("---------->"+sessionId+userId+secureKey+message);
    //alert("msg ---> : "+ message);
    try
    {
        xmlhttp.onreadystatechange=function()
        {
            //alert("Status : "+xmlhttp.status+"\nreadyState : "+xmlhttp.readyState);
            if (xmlhttp.readyState==4 && xmlhttp.status==200)
            {
                //alert("Message ----> : "+xmlhttp.responseText.toString());
                //alert("Decoded Message----> : "+decodeURIComponent(xmlhttp.responseText.toString()));
                //var checkMsg = decodeURIComponent(xmlhttp.responseText.toString());
                var checkMsg = xmlhttp.responseText.toString();
                if(checkMsg != "null" && checkMsg != null){
                    //document.getElementById("textarea").innerHTML +=  checkMsg;
                    if(textarea.value == "")
                        textarea.value = checkMsg;
                    else
                        textarea.value += "\n"+ checkMsg;
                }
            }
        };

        xmlhttp.open("POST","SendMessageAction?sessionId="+sessionId+"&userId="+userId+"&securekey="+secureKey+"&message="+encodeURIComponent(message)+"&sid="+Math.random(),true);
        xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        xmlhttp.setRequestHeader("charset","UTF-8");        
        xmlhttp.send();

    }
    catch(err)
    {
        alert(err.description);
    }
}

In my servlet,

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


        PrintWriter out = response.getWriter();

        msg = request.getParameter("message");
        //System.out.println("msg -----> : "+msg);
        seckey = request.getParameter("securekey");
        uid = request.getParameter("userId");
        sessionId = request.getParameter("sessionId");
        //counter =Integer.parseInt(request.getParameter("counter"));
        counter = 1;
        protocol = ApplicationInfo.flexProtocol;

        message = new SendMessage();
        message.send(msg, seckey, uid, sessionId, counter, protocol);

        CustomerInfo customer = ApplicationInfo.customerDetails.get(uid);

        out.print(customer.getMessage());


    }

Thanks in advance..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:57:55+00:00Added an answer on June 14, 2026 at 6:57 pm

    But at agent side in displays நà¯à®à¯à®à®³à¯ à®à®ªà¯à®ªà®à®¿ à®à®°à¯à®à¯à®à®¿à®±à¯à®°à¯à®à®³à¯ for நீங்கள் எப்படி இருக்கிறீர்கள்(in english – how are you)…

    You will get exactly this result when ISO-8859-1 is incorrectly been used to decode the given characters to bytes before transmitting them over the HTTP line, or when the client is incorrectly been instructed to ust ISO-8859-1 to encode the retrieved bytes to characters. Here’s the evidence:

    System.out.println(new String("நீங்கள் எப்படி இருக்கிறீர்கள்".getBytes("UTF-8"), "ISO-8859-1"));
    

    You basically need to instruct the servlet container to use UTF-8 to decode the given characters to bytes and the client to use UTF-8 to encode the retrieved bytes to characters. It would otherwise default to ISO-8859-1. This can be done in the servlet as follows, before you write anything to the response:

    response.setCharacterEncoding("UTF-8");
    

    See also:

    • Unicode – How to get the characters right?

    Unrelated to the concrete problem, you’ve other potential encoding problems; you haven’t instructed your JSP to render the response using UTF-8 as well. Only setting the @page contentType is not sufficient, you also need to set the @page pageEncoding. Even more, setting alone it is already sufficient as JSP already defaults to text/html.

    <%@ page pageEncoding="UTF-8"%> 
    

    Once you’ve fixed that, then you should add another line to the servlet code, before the first request.getParameter() call ever in order to instruct the container to use UTF-8 to encode the request parameters.

    request.setCharacterEncoding("UTF-8");
    

    Also note that the HTML <meta> tag is not been used when the page is served over HTTP. It’s plain ignored. It’s only been used when the enduser saves the HTML output to a HTML file on disk and then reopens it from disk by file:// URI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the deal. I'm trying to make a chat-like application that works with MySQL.
I am making a chat web application, to send a message, there's an input
I was trying to develop a chat application using C programmable sockets. I need
I am developing an application in asp.net mvc where i need to have Chat
I'm making a chat application that works with long-polling to emulate a push from
I've made a chat application for a website. Everything is working fine, however, I
As a marionnette beginner, I am trying to make a simple chat application using
I have been working on a chat application and I need some suggestions to
I am writing a udp chat application in c. I need to test if
I am making a simple chat application and I am trying to find out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.