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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:38:52+00:00 2026-06-01T00:38:52+00:00

Tomcat does not encode correctly String literals that contain unicode characters. The problem occurs

  • 0

Tomcat does not encode correctly String literals that contain unicode characters. The problem occurs at a Linux server but not on my development machine (Windows). It affects ONLY String literals (not Strings read from DB or from file!!!).

  • I have set the URIEncoding="utf-8" at the Connector tag (server.xml).
  • I have used setCharacterEncoding().
  • I cheched the stack trace (no filters that might set encoding).
  • I have set the LANG environment variable
  • I cheched the HTTP Headers and they are correct (Content-Type=text/plain;charset=utf-8)
  • I checked the encoding at the browser and it is correct (UTF-8)

Nothing of the above works. Any ideas on what I might be missing?

public class Test extends HttpServlet {

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    resp.setCharacterEncoding("utf-8");
    resp.setContentType("text/plain;");

    Writer w = resp.getWriter();
    w.write("Μαλακία Latin"); //Some unicode characters
    w.close();
}

The above shows this at the browser.
Îλληνικά Latin

  • 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-01T00:38:54+00:00Added an answer on June 1, 2026 at 12:38 am

    You can force the encoding of files when javac reads them by passing in -encoding ‘utf-8’ or -encoding ‘iso-8859-1’ when compiling. Just make sure that it matches whatever encoding your .java files are actually encoded as.

    http://docs.oracle.com/javase/6/docs/technotes/tools/windows/javac.html

    -encoding encoding Set the source file encoding name, such as EUC-JP and UTF-8. If -encoding is not specified, the platform default
    converter is used.

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

Sidebar

Related Questions

I have JSP that works fine in Tomcat 7 but does not work in
Currently we have a script that does maven build + tomcat deploy. Deploying to
I keep getting this error when I call 'tomcat:run'. The plugin 'org.apache.maven.plugins:maven-tomcat-plugin' does not
After moving jbilling (www.jbilling.org) to tomcat 7, it does not start up anymore and
It seems that nginx does not support chunked requests well. But I'm trying to
When I click on undeploy in the Tomcat manager it sometimes does not remove
I have a Java EE web application that does not make use of EJBs.
Tomcat documentation (http://tomcat.apache.org/tomcat-6.0-doc/config/context.html) Only if a context file does not exist for the application
I'm going mad with the following problem which does not happen on any other
I've a java web application running on an Tomcat server(Linux). In the production environment

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.