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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:21:01+00:00 2026-06-16T14:21:01+00:00

When I use django, I write a method can be invoked by http:// myhost/XXX/testIndex

  • 0

When I use django, I write a method can be invoked by http:// myhost/XXX/testIndex

def testIndex(request):
    res = os.system('java -jar test.HelloWorld' > /tmp/log)
    ... ...

and the HelloWorld java is as follows:

    public class HelloWorld {
    public static void main(String[] args) throws IOException {
        System.out.println("hello!");
        System.out.println("你好!");
}

When I access the http:// myhost/XXX/testIndex, the result is when I open the /tmp/log file, the UTF-8 chars is not correct!
like this

hello! ??!

What happened ? BTW, I am under linux centOS

  • 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-16T14:21:02+00:00Added an answer on June 16, 2026 at 2:21 pm

    You have two problems:

    1. You have put non-ASCII characters in your Java source. This is not generally considered good practice, because you will need to tell the Java compiler what encoding you have used for the source file. If it’s UTF-8, try: javac -encoding UTF-8 HelloWorld.java.

    2. The default encoding for System.out may not be UTF-8. It would help if you said which JRE you are using, as different implementations may behave slightly differently. You may be able specify the encoding explicitly with java -Dfile.encoding=UTF-8, although this is also not recommended. If it’s the Sun or OpenJDK JRE, you need to set the LANG environment variable before Java starts; you might do this in your webserver configuration, or by using the subprocess python module which allows you to specify the environment passed to the new process.

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

Sidebar

Related Questions

I am trying to use django-socialauth ( http://github.com/uswaretech/Django-Socialauth ) for authenticating users for my
the method is: def printa(x): return x the response is: self.response.out.write(template.render(path, {'printa':printa})) the html
I've been trying to use Django-appengine to write a small web app, but I
So I'm attempting to write a Django reusable app that provides a method for
I use django.contrib.messages module to create flush messages. These messages can be shown in
I use Django's render_to_response to return an XML document. This particular XML document is
I use django admin for my users to add their Model objects, as you
I use Django social-auth (omab version just to avoid any confusion with the other
Is it possible to use django class based generic views with a ManyToManyField relation?
I'd like to use django list_filter to filter by some enum value. Due to

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.