1
votes

i wrote a small application that will monitor the clipboard and paste text directly in a webbrowser component.

...
DocumentWysiwyg = ClipBoardWebBrowser.Document.DomDocument as IHTMLDocument2;
DocumentWysiwyg.designMode = "On";
...

and when the Clipboard changes, i paste the Clipboard content into the webbrowser using:

ClipBoardWebBrowser.Document.Write(Clipboard.GetText(TextDataFormat.Html));

now, when pasting any copied content from web as html, i get inside the html

span class="Apple-converted-space"> </span

which does not belong to the html i copied from a website.

what are those? and how can i get rid of them? any help is really appreciated .

here is the html code for google.de as example http://pastie.org/pastes/3706386/text

how would i make sure that the pasted clipboard is exactly the same as the copied data in the clipboard?

1

1 Answers

0
votes

On Mac multiple occurrences of a regular space " " get converted such that they replace every other regular space with a non-breaking space character aka   This allows the spaces to still break on every other character, but preserve such ranges of spaces.

The reason for this is because without this trick HTML would compress multiple spaces to a single one. Having only   characters would disable line wrapping, because as their name states they would be non-breaking.

In addition to "Apple-converted-space" there was also "Apple-style-span" but that was eliminated from Webkit in 2011: https://www.webkit.org/blog/1737/apple-style-span-is-gone/

So to answer your question: since Webkit is filling the pasteboard you cannot do anything to prevent such behavior.