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 798633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:00:12+00:00 2026-05-14T23:00:12+00:00

I’d like to display some language specific characters from javascript but I can’t. My

  • 0

I’d like to display some language specific characters from javascript but I can’t.

My app is a Java webapp and the front end is jQuery. All the characters that are sended from the server – in a JSP or with AJAX – are displayed properly. When I want to display some text hardcoded in to the javascript file it’s broken.

I’m using Eclipse. In the JSP’s header I use:

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

I’ve tried this (charset in the script element) too:

<script type="text/javascript" charset="utf-8"><c:import url="/JS/mainJS.js" /></script>

In my Eclipse I’ve set the project properties / text file encoding to UTF-8 AND I’ve checked the JS files’ resource properties / text file encoding that is UTF-8 too.

But when I try this:

$.test = function(){
    var s = "éééáááűűűű";
    alert(s);
}

I get:

éééáááűűűű

The strange thing is that: When I try in a separate html file (in the same project), It’s working:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
  <head>
    <title>Test</title>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

    <style type="text/css">
        body {background: #c0c0c0;}
    </style>

    <script type="text/javascript">
        $(document).ready(function(){
            var s = "éááűűúúú";
            $("#console").text(s);
            alert(s);
        })
    </script>

  </head>

  <body>
        <div id="console"></div>
  </body>
</html>

Even if I DO NOT use any content type and page encoding settings.

What is the problem? What shall I do? (I’m using Apache Tomcat integrated in Eclipse)

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-05-14T23:00:12+00:00Added an answer on May 14, 2026 at 11:00 pm

    The c:import uses the server platform default encoding if the encoding is absent in the response header of the request. Rather just use src attribute instead. The webbrowser is smarter in this.

    <script type="text/javascript" src="/JS/mainJS.js"></script>
    

    (if necessary remove the leading slash if you’re running on a fixed context instead of on domain root)

    If you really, really need the c:import for this (for which I honestly don’t see any advantage in this particular situation), then you need to write a Filter listening on /JS/* which sets the appropriate Content-Type header with the correct encoding on the response. This however won’t work if it concerns an external URL, it’s then the responsibility of the external server.

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

Sidebar

Ask A Question

Stats

  • Questions 447k
  • Answers 447k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Unfortunately, tables can't be the target of parameter substitution (I… May 15, 2026 at 7:38 pm
  • Editorial Team
    Editorial Team added an answer What you are asking for is a Database File System.… May 15, 2026 at 7:38 pm
  • Editorial Team
    Editorial Team added an answer Edit for this specific Google Visualization API: The .draw() method… May 15, 2026 at 7:38 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.