让FCKeditor支持中文——解决“Error loading "/fckeditor/fckstyles.xml" ”
来源:互联网 发布:mac配置path 编辑:程序博客网 时间:2024/06/08 17:18
如果大家看到如图1那样的提示信息的话,说明你的网站名用了中文了。原来以为,asp.net 2.0应该是对中文支持得很好了,结果却是没有那么乐观。项目的名称(网站名称)如果是中文,那么fckeditor就出现了一个xml无法加载的问题:“Error loading "/fckeditor/fckstyles.xml" ”。(见图1-图3)
图1
图2
图3
例如我这个项目叫做订菜系统,那么,在VS里面运行的时候,就是http://localhost:1690/订菜系统/abc.aspx这样。
而fckeditor会在 fckeditor\editor\js\fckeditorcode_ie.js 这个脚本里面,根据浏览器地址,生成“FCKConfig.BasePath”,然后再把FCKConfig.BasePath截去一部分,生成FCKConfig.EditorPath,也就是下面这行代码:
var FCKConfig=FCK.Config={};if (document.location.protocol=='file:'){ FCKConfig.BasePath=decodeURIComponent(document.location.pathname.substr(1)); FCKConfig.BasePath=FCKConfig.BasePath.replace(/\\/gi, '/'); var sFullProtocol=document.location.href.match(/^(file\:\/{2,3})/)[1]; if (FCKBrowserInfo.IsOpera) sFullProtocol+='localhost/'; FCKConfig.BasePath=sFullProtocol+FCKConfig.BasePath.substring(0,FCKConfig.BasePath.lastIndexOf('/')+1);}else FCKConfig.BasePath=document.location.protocol+'//'+document.location.host+document.location.pathname.substring(0,document.location.pathname.lastIndexOf('/')+1);FCKConfig.FullBasePath=FCKConfig.BasePath;FCKConfig.EditorPath=FCKConfig.BasePath.replace(/editor\/$/,'');
其中倒数第一行:“FCKConfig.EditorPath=FCKConfig.BasePath.replace(/editor\/$/,'');”就是生成了“FCKConfig.EditorPath”。
在“fckconfig.js”文件里加载“fckstyles.xml”这个文件,就要使用到这个“FCKConfig.EditorPath”,代码如下:
FCKConfig.StylesXmlPath = FCKConfig.EditorPath + 'fckstyles.xml' ;
经过我在IE6下测试,不管是使用“http://localhost:1690/订菜系统/”的方式(原文);还是使用“http://localhost:1690/%e8%ae%a2%e8%8f%9c%e7%b3%bb%e7%bb%9f/”的方式(转换),都会报错。而且我在“fckconfig.js”中加了一行代码做测试:window.status = FCKConfig.EditorPath,IE状态栏始终显示的是“http://localhost:1690/订菜系统/”。
最后的解决办法是:对“FCKConfig.EditorPath”编码,即encodeURI(FCKConfig.EditorPath) 。我顺便把下面那个xml加载也加了编码,代码如下: (以下两行在fckconfig.js文件里大概160行的地方)
FCKConfig.StylesXmlPath = encodeURI(FCKConfig.EditorPath) + 'fckstyles.xml' ;
FCKConfig.TemplatesXmlPath = encodeURI(FCKConfig.EditorPath) + 'fcktemplates.xml' ;
- 让FCKeditor支持中文——解决“Error loading "/fckeditor/fckstyles.xml" ”
- 解决“Error loading "/fckeditor/fckstyles.xml" ”
- 成功解决FCKeditor在weblogic下成功发布和使用 Error loading "/FCKeditor/fckstyles.xml"
- 通过虚拟地址解决fckeditor错误的加载/fckeditor/fckstyles.xml—— 补充
- 通过虚拟地址解决fckeditor错误的加载/fckeditor/fckstyles.xml
- 通过虚拟地址解决fckeditor错误的加载/fckeditor/fckstyles.xml
- FCKeditor XML request error 404
- 让FCKeditor支持上传附件与媒体
- FCKeditor在线编辑器解决中文乱码办法
- FCKEditor
- FCKeditor
- fckeditor
- FckEditor
- FCKeditor
- FCKeditor
- fckeditor
- FCKeditor
- Fckeditor
- 专题二—玩转Log,打开Java之门
- Unity3D
- JAVA中int、String的类型转换
- Android注册广播有几种方式,分别是什么?
- C#中的文件上传
- 让FCKeditor支持中文——解决“Error loading "/fckeditor/fckstyles.xml" ”
- 关于响应式页面
- Eclipse/MyEclipse 对接口@Override 注解报错的解决方案
- Python函数式编程指南(三):迭代器(写得挺清楚,看着没那么累)
- adb的安装以及命令
- 探讨PHP获取checkbox值
- Java源码生成API
- 《the cave》攻略及感悟
- 专题四—介绍Manifest文件的使用