[opencms-dev] International (non ISO-8859-1) charset problem and patch (???) for current CVS version
Dimitri Bougoulias
D.Bougoulias at ieee.org
Mon Apr 7 12:55:03 CEST 2003
I'm resending the message since up to know it has not appeared in the new
archive....
Hello,
I use charset ISO-8859-7 as default with current CVS version (2003.04.04
17.52 EET). Had problems editing Greek texts but this was fixed with last
CVS change of com/opencms/util/Encoder.java (thanks ! :-) So html editor
works now OK (even though text editor still shows greek chars as "&#nnn;"
sequences.
Still there was a problem in displaying non ISO-8859-1 chars in explorer
view (explorer_files.html frame) in "title"column.
Also in the property view, properties like "Title" and "navtext" (important
to display non ascii in international setups) display in escaped form even
though they can be entered normaly. Displaying title correctly in the
resulting page was solved by changing escapeHtml to false in the jsp
template and I solved the problem for explorer view an property view by the
following patch (also as attachment). Still remains to solve the problem in
the new resources views (e.g. new page, new folder etc.). At the moment as a
workaround I enter english title and nav text in the new resource and then I
change it to the desired non ISO-8859-1 using the propery view.
The same problem must be solved in the tasks view so that one can enter non
ISO-8859-1 chars at least in the "subject" and "description" fields.
Best regards,
Dimitrios Bougoulias
------------------------------ cut here
----------------------------------------
diff -ru opencms/opencms/src/com/opencms/util/Encoder.java
opencms.dkb/opencms/src/com/opencms/util/Encoder.java
--- opencms/opencms/src/com/opencms/util/Encoder.java 2003-03-20
15:38:45.000000000 +0200
+++ opencms.dkb/opencms/src/com/opencms/util/Encoder.java 2003-04-04
17:47:34.000000000 +0300
@@ -233,6 +233,7 @@
public static String escapeXml(String source) {
if (source == null) return null;
StringBuffer result = new StringBuffer(source.length()*2);
+ int terminatorIndex;
for(int i = 0;i < source.length(); ++i) {
char ch = source.charAt(i);
switch (ch) {
@@ -243,7 +244,15 @@
result.append(">");
break;
case '&' :
- result.append("&");
+ // Don't escape already escaped international
characters
+ if ((terminatorIndex = source.indexOf(";",i)) > 0)
+ //
if(source.substring(i+1,terminatorIndex).matches("lt|gt|amp|quot|#[0-9]+"))
+
if(source.substring(i+1,terminatorIndex).matches("#[0-9]+"))
+ result.append(ch);
+ else
+ result.append("&");
+ else
+ result.append("&");
break;
case '"' :
result.append(""");
diff -ru
opencms/opencms/src/com/opencms/workplace/CmsNewExplorerFileList.java
opencms.dkb/opencms/src/com/opencms/workplace/CmsNewExplorerFileList.java
--- opencms/opencms/src/com/opencms/workplace/CmsNewExplorerFileList.java
2003-03-04 19:30:10.000000000 +0200
+++
opencms.dkb/opencms/src/com/opencms/workplace/CmsNewExplorerFileList.java
2003-04-04 05:38:09.000000000 +0300
@@ -360,7 +360,7 @@
title = "";
}
content.append("\"");
- if (title != null)
content.append(Encoder.escapeHtml(title));
+ if (title != null) content.append(title);
content.append("\",");
}else{
------------------------------ cut here
----------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opencms-international.patch
Type: application/octet-stream
Size: 2148 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20030407/f23e8029/attachment.obj>
More information about the opencms-dev
mailing list