Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36604
| Path | csiph.com!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | parmenides <xparmenides@yahoo.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | How to compile source files encoding in utf-8 with eclipse? |
| Date | Fri, 12 May 2017 18:58:49 +0800 |
| Organization | Aioe.org NNTP Server |
| Lines | 32 |
| Message-ID | <of44h5$1sgk$1@gioia.aioe.org> (permalink) |
| NNTP-Posting-Host | iJSg8OFItZCheGsju5GzGQ.user.gioia.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| X-Mozilla-News-Host | news://nntp.aioe.org:119 |
| Xref | csiph.com comp.lang.java.programmer:36604 |
Show key headers only | View raw
Hi all,
I am developing a tiny JSP app, and encounter a strange problem. I use
Eclipse as IDE and want to use utf-8 to encode everything such as source
files, JSP pages and class files. There are serveral settings I have done:
1. Windows > Preference > General > Workspace > Text file encoding > utf-8.
2. Windows > Preference > General > Content Types > Text > Java Source
File > utf-8.
3. Windows > Preference > General > Content Types > Java Class File > utf-8.
Then, I restarted Eclipse.
The server is Tomcat 9.0. A Servlet is created with its doGet() code:
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
response.getWriter().write("****");
}
ps. * represents a chinese character.
When runinng on the server (starting from Eclipse), there some '?' on
the page. I think there are some troubles about encoding. Then, I
recompiled the source file on the command line with the following command:
javac -encoding utf-8 filename -classpath ...
and copied the generated class file into tomcat's app directory. The
page display the chniese characters normally. I think the difference is
at the encoding of class file. I can change that by command line with
-encoding option, but how to do that with Eclipse? Or there something I
have not been aware of.
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
How to compile source files encoding in utf-8 with eclipse? parmenides <xparmenides@yahoo.com> - 2017-05-12 18:58 +0800 Re: How to compile source files encoding in utf-8 with eclipse? Marcel Mueller <news.5.maazl@spamgourmet.org> - 2017-05-12 15:04 +0200
csiph-web