views:

970

answers:

1

When I write out some text (standard English, no fancy characters) in Word using Windgings as a font, copying the text and pasting into an html textfield results in the OS's "I don't know what character this is" characters (little squares on Windows).

It seems that changing the font (what should be a display-only property) is preventing the text from being pasted correctly into the input field.

Why does it not paste the text directly? Is there anything I can do to stop the 'little squares' problem?

+5  A: 

There are 2 problems here:

  1. The standard text field on a web page only accepts/displays plain text. When you add "Wingdings" characters to a Word document, you're actually changing the font for that character to "Wingdings." This is possible because most modern text editors use advanced document formats like RTF, ODF, one of the various Word formats, etc.

    So when you copy and paste a selection of text from Word to your browser, all the text formatting (including the font information) is lost. The pasted text will simply be shown in the font & style of that particular text field.

  2. Most documents on the internet are encoded using some form of Unicode encoding, typically UTF-8. Since Wingdings isn't mapped to Unicode, this prevents it from being displayed properly on web pages.

Calvin
RodeoClown
Nope. That font usage is specific to the way Word/Windows works. The WWW is not based on Word/Windows, it's based on plain old text + HTML markup.
Diodeus
I would have expected so initially too, as Windings characters are all mapped to printable ASCII characters. But I suspect that when you paste text into a web form, it has to convert the text to the character encoding of that document, since the browser can't render the document in more than one encoding.
Calvin
@Diodeus: That's what I mean though - shouldn't pasting it into a textfield just paste the text in, formatted in whatever font is being used by the browser to render it (Arial in this case)?
RodeoClown
@Calvin: Ahhh... good point. That makes sense.
RodeoClown