• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

default encoding problems

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my old server is redhat 7.1 + tomcat 4.0 + mysql
I fix my problems by
1. add LANG=th_TH to catalina and
2. add <%@ page contentType="text/html; charset=TIS620" %> to my jsp page
This can solve my problems.... but!!
my new server is redhar 7.3 + tomcat 4.1.10 + mysql
I can't use my old code... it display "???" with any data that download from mysql database(I try to display it on console "System.out.println(x)" it show the correct encoding.)
I fix my new problems by delete <%@ page contentType="text/html; charset=TIS620" %>" but it have new problem!!! user should change his encoding every time (IEMenu->view->encoding->Thai)
How to set default to Thai?
or I should fix my problem by other way?
Thank you.
ps. I already have "<meta http-equiv="Content-Type" content="text/html; charset=windows-874">" in my code.
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The browser picks up the encoding of the response object. Therefore, you need to set the encoding on the response before it is sent to the client.
For example,
response.setContentType("text/html;charset=TIS620");
 
Apirak Panatkool
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where I should add that like?
mycode:
<%@ page import="messages.*" %>
<%@ page import="java.util.*" %>
<%@ page contentType="text/html; charset=TIS620" %>
<html>
<head>
<title>Home :: PeTerPan</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>
<body bgcolor="#FFFFFF" >
แสดง <%=messages.getValue("1")%>
<% System.out.println(comm.getValue("1")); %>
</body>
</html>
browser result:
แสดง ???
console result:
แสดง ทดสอบภาษา
 
Erick Jones
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you accessing your JSP directly, or forwarding to it from a servlet?
Try placing it in your JSP.
 
Apirak Panatkool
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
directly to JSP
 
Apirak Panatkool
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I try to add this line
<%response.setContentType("text/html; charset=tis-620");%>
But it's work..
please help me.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic