Weird codes when pasting text into editor

Weird codes when pasting text into editor

door Martin Bangsø -
Aantal antwoorden: 6
Hello all.

We have a problem with the HTML-editor on latest version of Moodle, ie. whenever text is pasted into the editor (either from Word or from a text taken from a post within Moodle), these codes appear AFTER the message has been posted:

Både Kristian og jeg gør os tanker om målgruppen for faget <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;}@font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin;}.MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;}@page Section1 {size:612.0pt 792.0pt; margin:3.0cm 2.0cm 3.0cm 2.0cm; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;}div.Section1 {page:Section1;}--> religionspædagogik med kateketik

- as you can see, it makes it quite hard to read. The thing is, there is no way to see in advance if these codes will appear; when pasting into the editor, everything seems fine, but after the message has been posted the codes appear. The issue appears in both forum posts and wiki's and anywhere else the HTML-editor is in use.

Any suggestions?

Martin

Gemiddelde van de beoordelingen:  -
Als antwoord op Martin Bangsø

Re: Weird codes when pasting text into editor

door ben reynolds -
It's Microsoft Word (latest version) trash. Sometimes you can clean it up by pushing the "clean Word HTML" button.

You can see if it has been pasted in by using the Toggle HTML Souce button. Look at the top of the post. Often you can see where the trash ends and the post begins. Select the trash and hit delete.
Gemiddelde van de beoordelingen:  -
Als antwoord op ben reynolds

Ang: Re: Weird codes when pasting text into editor

door Martin Bangsø -
Thanks for the suggestion, but I'm pretty sure the problem also occurs if I paste text copied from another post in a Moodle-thread where Word has NOT been used in any way.
Gemiddelde van de beoordelingen:  -
Als antwoord op Martin Bangsø

Re: Weird codes when pasting text into editor

door Ann Adamcik -
This is an issue with Firefox 3 and MS Word (anything with the mso- prefix is from Word). The Clean Word HTML button removes some of the Word styles, but doesn't remove everything. See MDL-16621.
Gemiddelde van de beoordelingen:  -
Als antwoord op Martin Bangsø

Re: Weird codes when pasting text into editor

door Larry Elchuck -
May not be the most elegant solution but you could open a plain text editor ... paste the word text into it .... select the text in the plain text editor ... copy it ... then paste into Moodle. It does involve an intermediate step. I used this technique in the past and it worked well for me.
Gemiddelde van de beoordelingen:  -
Als antwoord op Larry Elchuck

Ang: Re: Weird codes when pasting text into editor

door Martin Bangsø -
As I said, it doesn't only happen when pasting text from MS Word, it also sometimes happens when pasting text from WITHIN Moodle. I haven't found a pattern yet, just laying it out for you guys glimlach

Gemiddelde van de beoordelingen:  -
Als antwoord op Martin Bangsø

Re: Ang: Re: Weird codes when pasting text into editor

door Lucian DiPeso -
The codes you pasted above are most definitely from Word (or some other Office program). Anything that has "mso" in it comes from Office.

It may be the case that you are copying from other text in Moodle that in turn came from Office.
Gemiddelde van de beoordelingen:  -