session = req.getSession(true);
if (req.getServerPort() == 443) http = "https"; else http = "http";
- res.setContentType("text/html");
+ res.setContentType("text/html; charset="
+ +MirConfig.getProp("Mir.DefaultEncoding"));
String moduleName = req.getParameter("module");
checkLanguage(session, req);
}
public String getServletInfo() {
- return "Mir 1.0 rev02 multilanguage";
+ return "Mir "+MirConfig.getProp("Mir.Version");
}
private void checkLanguage(HttpSession session, HttpServletRequest req) {
setLanguage(session,getAcceptLanguage(req));
}
- res.setContentType("text/html");
+ res.setContentType("text/html; charset="
+ +MirConfig.getProp("Mir.DefaultEncoding"));
try {
ServletModuleDispatch.dispatch(ServletModuleOpenIndy.getInstance(),req,res);
}
}
- public String getServletInfo(){ return "OpenIndy 1.0 rev01"; }
+ public String getServletInfo(){
+ return "OpenMir "+MirConfig.getProp("Mir.Version");
+ }
}
# Servlet / Module configurations
#
+# don't change this unless you really know your i18n.
+# The default encoding charset used in the written html files as well
+# as the dynamic output html.
+# also used for the HTML charset meta tag.
+Mir.DefaultEncoding=UTF8
Mir.Logfile=log/mir.log
Mir.ErrorTemplate=error.template
Mir.UserErrorTemplate=usererror.template
private static String imageHost;
private static String imagePath;
private static String openAction;
+ private static String defEncoding;
protected static String producerDocRoot =
MirConfig.getProp("Producer.DocRoot");
protected static String producerStorageRoot =
actionRoot = docRoot + "/servlet/Mir";
+ defEncoding = MirConfig.getProp("Mir.DefaultEncoding");
openAction = MirConfig.getProp("Producer.OpenAction");
productionHost = MirConfig.getProp("Producer.ProductionHost");
videoHost = MirConfig.getProp("Producer.VideoHost");
// values in the templates. -mh
// put standard configuration into tempalteRootmodel
SimpleHash configHash = new SimpleHash();
+ configHash.put("defEncoding", new SimpleScalar(defEncoding));
configHash.put("producerDocRoot", new SimpleScalar(producerDocRoot));
configHash.put("storageRoot", new SimpleScalar(producerStorageRoot));
configHash.put("productionHost", new SimpleScalar(productionHost));
// alle durchlaufen bis nix mehr da
theType = metadataTypes[i];
if (theType == java.sql.Types.LONGVARBINARY) {
- InputStream us = rs.getAsciiStream(i + 1);
- if (us != null) {
- InputStreamReader is = new InputStreamReader(us);
+ InputStreamReader is = (InputStreamReader)rs.getCharacterStream(i + 1);
+ if (is != null) {
char[] data = new char[32768];
StringBuffer theResultString = new StringBuffer();
int len;
File f = new File(producerStorageRoot + filename);
File dir = new File(f.getParent());
dir.mkdirs();
- FileWriter outputFile = new FileWriter(f);
+ // it's important that we set the desired encoding. It should be UTF8
+ // not the platform default.
+ OutputStreamWriter outputFileStream =
+ new OutputStreamWriter(new FileOutputStream(f),
+ MirConfig.getProp("Mir.DefaultEncoding"));
PrintWriter outStream;
if (compressed==true) {
- outStream = new LineFilterWriter(outputFile);
+ outStream = new LineFilterWriter(outputFileStream);
} else {
- outStream = new PrintWriter(outputFile);
+ outStream = new PrintWriter(outputFileStream);
}
HTMLTemplateProcessor.process(null,template, model, outStream,null);
- outputFile.close();
+ outputFileStream.close();
outStream.close();
printHTML(htmlout, "Produced <a href=\"" + producerProductionHost+
filename + "\">" + filename + "</a>");
//theLog.printInfo("Produced: " + producerStorageRoot + filename);
- //theLog.printDebugInfo("free mem:" + java.lang.Runtime.getRuntime().freeMemory());
+ //theLog.printDebugInfo("free mem:" + java.lang.Runtime.getRuntime().freeMemory());
//theLog.printDebugInfo("total mem:" + java.lang.Runtime.getRuntime().totalMemory());
return true;
} catch(IOException exception){
logHTML(htmlout, "Producer: File could not be written " + filename);
+ System.out.println(exception.toString());
return false;
} catch(HTMLParseException exception){
logHTML(htmlout,"Producer: Error in HTML-parsing: " + filename);
<html>
<head>
<title>${lang("start.htmltitle")}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta http-equiv="Content-Type" content="text/html; charset=${config.defEncoding}">
</head>
<body bgcolor="#FFFFFF" link="#666666" vlink="#990000" alink="#990000">
<html>
<head>
<title>${lang("producer.content.htmltitle")}${content.title}</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=${config.defEncoding}">
<link rel="stylesheet" href="/style/mir.css" type="text/css">
<if data.content.to_media_images>
<meta name="keywords" content="images"></meta>
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding=${config.defEncoding}?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
<html>
<head>
<title>${lang("producer.openposting.htmltitle")}${topic.title}</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=${config.defEncoding}">
<link rel="stylesheet" href="/style/mir.css" type="text/css">
</head>
<html>
<head>
<title>${lang("producer.startpage.htmltitle")}</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=${config.defEncoding}">
<link rel="stylesheet" href="/style/mir.css" type="text/css">
</head>
<html>
<head>
<title>${lang("producer.topiclist.htmltitle")}${topic.title}</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=${config.defEncoding}">
<link rel="stylesheet" href="/style/mir.css" type="text/css">
</head>
<xsl:output
method="xml"
- encoding="iso-8859-1"
+ encoding="${config.defEncoding}"
omit-xml-declaration="yes"
doctype-public="-//WAPFORUM//DTD WML 1.1//EN"
doctype-system="http://www.wapforum.org/DTD/wml_1.1.xml"