Dan,
While treat source files as UTF-8 encoding,these invalid chars will be
reported as warnings in my IntelliJ IDEA 5.0 development env(WIN32).
I change the java option from -Dfile.encoding=utf-8 to
-Dfile.encoding=gbk( my local charset),it seems rights, and it doesn't
limit using utf-8 in
xwiki links and document contents.
By apply following changs, utf-8 seems work fine
* install MySQL 5.0.27, select utf8 as default charset,and do not select
STRICT mode on config instance.
*found xwiki's config file hibernate.cfg.xml,change connect uri to
<property name="connection.url">
jdbc:mysql://localhost/xwiki?useUnicode=true&characterEncoding=utf-8</property>
*found tomcat's config file server.xml,add URIEncoding option to Connector's
parameter:
<Connector port="8080" maxHttpHeaderSize="8192"
URIEncoding="UTF-8"
maxThreads="150" minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false" redirectPort="8443"
acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"
/>
*found xwiki's config file web.xml,change encoding charset from
iso-8859-1 to UTF-8.appling this change to
xwiki.cfg,velocity.properties too.
*and source codes:
D:\dev\xwiki\trunk\core\src\main\java\com\xpn\xwiki\web>svn diff Utils.java
Index: Utils.java
===================================================================
--- Utils.java (修订版 1748)
+++ Utils.java (工作拷贝)
@@ -393,18 +393,28 @@
}
}
+ public static String FixUtf8(String str)
+ {
+ try {
+ byte b[]=str.getBytes("ISO-8859-1");
+ int lp=b.length;
+ while(--lp>=0 && b[lp]>=0) {};
+ if(lp>=0) return new String(b,"UTF-8");
+ }
+ catch(Exception e)
+ {
+ }
+ return str;
+ }
+
public static String decode(String name, XWikiContext context) {
try {
// Make sure + is considered as a space
String result = name.replace('+', ' ');
-
+ String ret=URLDecoder.decode(result, context.getWiki().getEncoding(
));
// It seems Internet Explorer can send us back UTF-8
// instead of ISO-8859-1 for URLs
- if (Base64.isValidUTF8(result.getBytes(), false))
- result = new String(result.getBytes(), "UTF-8");
-
- // Still need to decode URLs
- return URLDecoder.decode(result, context.getWiki().getEncoding());
+ return FixUtf8(ret);
} catch (Exception e) {
return name;
}
D:\dev\xwiki\trunk\core\src\main\java\com\xpn\xwiki\web>svn diff
XWikiServletRequest.java
Index: XWikiServletRequest.java
===================================================================
--- XWikiServletRequest.java (修订版 1748)
+++ XWikiServletRequest.java (工作拷贝)
@@ -88,7 +88,7 @@
}
public String getPathInfo() {
- return request.getPathInfo();
+ return Utils.FixUtf8(request.getPathInfo());
}
public String getPathTranslated() {
* Thanks Michael for give us detailed method to export utf-8 document
as
pdf(http://mail-archive.objectweb.org/xwiki-dev/2006-03/msg00030.html).
I use this command to get info of charset:
java -cp fop-0.20.5.jar org.apache.fop.fonts.apps.TTFReader -ttcname
"SimSun" D:\MYFONTS\simsun.ttc simsun.xml
Best regards,
Jackson Wang
2006/12/14, Dan Murphy <dm.subs(a)googlemail.com>om>:
Hi,
There seems to be a problem when I synchronise with the svn repository on
my linux (kubuntu 6.06) machine...
Eclipse fails to compile and calls out the following files as containing
invalid chars:
core/src/main/java/com.xpn.xwiki.util.Util
core/src/main/java/com.xpn.xwiki.render.macro.UseMacro
core/src/main/java/com.xpn.xwiki.render.macro.DisplayMacro
core/src/main/java/com.xpn.xwiki.web.ImportAction
core/src/main/java/com.xpn.xwiki.web.ExportAction
All these files are aparently unreadable using UTF-8 encoding - from what
I can see it is due to accents etc in the source files (for creation dates,
eg Date: 25 août 2004 in DisplayMacro).
I can fix the problem for myself (tell Eclipse to treat them as ISO-8859-1
not UTF-8)...
Anyone else suffering this? Should the source get changed so that the
chars are valid utf ones ?
A minor issue... looking forward to beta 1 - when the download link works
;)
Cheers,
Dan
--
You receive this message as a subscriber of the xwiki-dev(a)objectweb.orgmailing list.
To unsubscribe: mailto:xwiki-dev-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page:
http://www.objectweb.org/wws