[opencms-dev] XML Content Editor Not Saving Special Characters Correctly
Brett Sheeran
brett.sheeran at gmail.com
Sat Apr 18 04:19:38 CEST 2009
> ---------- Forwarded message ----------
> From: Brett Sheeran <brett.sheeran at gmail.com>
> To: opencms-dev at opencms.org
> Date: Thu, 16 Apr 2009 14:05:20 +1000
> Subject: [opencms-dev] XML Content Editor Not Saving Special Characters
> Correctly
> Hi,
>
> I have a problem with the XML Content editor not saving special
> characters correctly. However, I can save the same characters in the
> same XML file if I use "Edit Control Code". Can anyone help please?
> Details as follows.
>
> I find that if I save a special character in the XML content editor,
> (in particular the pound "?" character), the XML content editor seems
> to append an extra character so the value stored becomes "??".
>
> I am using OpenCMS 7.0.5 and MySQL 5.1. It appears to me that
> everything on my system is set up for UTF-8.
>
> The JDBC connection is configured thus:
> db.pool.default.jdbcUrl.params=?characterEncoding\=UTF-8
>
> In the <head> of the editor page, I see the following metatag:
> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
>
> I ran a sniffer on the submit. I see this string in the request header:
> Content-Type: application/x-www-form-urlencoded
>
> And this string in the response header:
> Content-Type: text/html;charset=UTF-8
>
> The *really* strange thing is that if I use "Edit Control Code" to
> edit the same XML file I can save the special characters correctly.
>
> Saving the special character as a code "£" will only work once
> because the second time I am saving the "?" character again.
>
> As a temporary workaround, I use "Edit Control Code" to remove the "?"
> characters.
>
> Incidentally, a former colleague "skinned" a few OpenCMS JSPs. If
> anyone thinks that might be a problem, I would be interested to know
> which JSPs are associated with the XML Content Editor. I am wondering
> if there should be a tag like this in a JSP somewhere:
> <%@ page pageEncoding="UTF-8" %>
>
> Thank you.
>
> Regards BrettS
>
>
>
>> ---------- Forwarded message ----------
>> From: Christian Steinert <christian_steinert at web.de>
>> To: The OpenCms mailing list <opencms-dev at opencms.org>
>> Date: Thu, 16 Apr 2009 07:51:25 +0200
>> Subject: Re: [opencms-dev] XML Content Editor Not Saving Special Characters
>> Correctly
>> Hi
>>
>> this sounds strange indeed.
>> Have you tried to explicitly set the "encoding" file system property of
>> your pages (or their parent folder) to "UTF-8"?
>> I don't think that setting the JSP pageEncoding will make any difference
>> because your response encoding is set to UTF-8 already.
>>
>> Kind Regards
>> Christian
Hi Christian,
Thanks for your reply. I tried a few things but sadly, I still cannot
fix my problem with the XML Content editor adding garbage to special
characters. Details as follows.
I presume you were referring to the "content-encoding" property of the
JSPs within the virtual file system. So, I tried setting the
"content-encoding" property of the following JSPs (and folder) to
"UTF-8":
system/workplace/editors/editor.jsp
system/workplace/editors/editor_main.jsp
system/workplace/editors/xmlcontent/editor.jsp
system/workplace/editors/xmlcontent/editor_form.jsp
system/workplace/editors
But sadly, this change did not fix my problem. The XML Content Editor
is still appending garbage characters in front of any special
characters in my text. Whereas, "Edit Control Code" will still save
special characters correctly. Incidentally, my content JSPs will
render special characters correctly. The problem is getting the
special characters in, not getting them out.
Am I changing the correct property? Are there other files I should change?
Thanks.
Regards Brett S
More information about the opencms-dev
mailing list