J'ai utilisé le code ci-dessous pour obtenir la sortie sur le navigateur en utilisant l'éditeur.Obtenir des caractères indésirables dans Firefox où fonctionne aussi bien dans IE
String b= new String(a.getBytes("UTF-16LE"),"UTF-8");
La sortie est très bien avec IE mais dans firefox je reçois
< h3> Commentaires </h 3 > < t a b l e > < t r b g c o l o r = ' # E 7 E 7 E F ' > < t d > P o s t e d O n : 1 2 - 1 3 - 2 0 1 0 1 0 : 3 8 : 2 4 , B y :
Voici l'exemple de sortie du problème.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"w3.org/TR/html4/loose.dtd">;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
CONTENT="no-cache">
</head>
<body>
<form name="form" method="post">
<%
String theString = null;
PrintWriter pw = null;
String cmntbox = "";
ServletOutputStream outStream = null;
try {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = null;
InputStream sImage;
con = DBConnection.getConnection();
sql = SELECT statement
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next()) {
byte bytearray[] = new byte[1048576];
String newLine = System.getProperty("line.separator");
sImage = rs.getBinaryStream(1);
StringWriter writer = new StringWriter();
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
pw =response.getWriter();
IOUtils.copy(sImage, writer);
theString = writer.toString();
pw.write(theString);
pw.flush();
cmntbox = Utility.getCommentPage(id,prcs_area);
String comment = new String(cmntbox.getBytes("UTF-16LE"),"UTF-8");
pw.write(comment);
pw.flush();
pw.close();
}
Votre '' n'est pas valide et devrait être deux balises ''. (Et je doute que l'exemple de code corresponde à votre code actuel?) – Arjan
TWO tags ?? puis-je savoir comment ou où mettre cet arjan .. –
simplement '' * et * ' 'ou' '. Vous ne savez pas exactement ce qui est autorisé dans HTML 4. – Arjan