[Zope-CMF] Content Garbling...

seb bacon seb@jamkit.com
Wed, 10 Jul 2002 16:27:43 +0100


Jeff,

Please keep messages on the mailing list: (1) others may find your 
problem/solutions useful; and (2) I may not have time to respond, but 
someone else will probably have the time.

It's most likely a content-encoding problem.  Perhaps your WYSIWYG tool 
is not producing HTML entities for bullets (i.e. •).

You'll also get into problems replacing line breaks like that. Browsers 
/ platforms differ on what consitutes a line break: \r\n or \r or \n.

You should debug the problem by finding a reproduceable example.  Your 
server will not be changing the content at random, of course.  Either 
you are viewing the content from different platforms, or someone has 
re-edited the content.

seb

Jeff Ross wrote:
> Thanks for your response.
> 
> It's actually happening on my own Article class. Articles are edited with a
> WYSIWG dhtml tool in IE, and a regular old textarea in other browsers.
> Content is always saved as HTML, so when you edit in non-ie, the <BR> and
> <P> tags are replaced with carriage returns by the translatedText function
> below. When the content is saved, _toHTML replaces carriage returns with
> <BR> tags.
> 
> The strange thing is, content is getting replaced after the article is
> successfully saved. Like a day later, we found that bullent points were
> replaced with question marks. I can't account for this based on my code.
> 
> Any ideas?
> 
> Jeff
> 
>     _replaceBR = re.compile('<br>', re.IGNORECASE)
>     _replaceP = re.compile('<p>(.*?)</p>', re.IGNORECASE | re.DOTALL)
> 
>     def _toHTML(self, text):
>         return string.replace(text, '\n', '<BR>')
> 
>     def translatedText(self):
>         """ Get Translated text """
> 
>         text = string.replace(self.text, '\r', '')
>         text = string.replace(text, '\n', '')
> 
>         text = self._replaceBR.sub('\n', text)
>         text = self._replaceP.sub('\\1\n\n', text)
> 
>         return text
> 
> 
> ----- Original Message -----
> From: "seb bacon" <seb@jamkit.com>
> To: "Jeff Ross" <thejeffross@hotmail.com>

> 
>>
>>Jeff Ross wrote:
>>
>>>I'm running Zope 2.5.1 and CMF 1.2 on Windows 2000 behind Apache. From
>>
> time
> 
>>>to time, content that I have entered into my portal is getting garbled.
>>
> What
> 
>>>I mean is words will be replaced with garbage. In one instance, bullet
>>>points were replaced with question marks. Does anyone have any idea what
>>>this could be?
>>
>>Sounds to me like a content-encoding issue.  How are you editing the
>>text?  As HTML or structured text?
>>
>>If you can reproduce the problem in the same browser on the same client
>>machine using the same text, you should file a report in the collector
>>(see email footer).
>>
>>
>>>Is this something that could happen if the server runs out of memory?
>>
>>No.
>>