Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does copying and pasting non-breaking spaces compare in different systems/browsers?

Suppose you have an HTML document with non-breaking spaces ( ). In IE 6 - 8 running on Windows XP, when you select the non-breaking spaces and copy/paste them, they will be copied/pasted as "normal" spaces (U+0020).

Does anyone know of any systems, browsers, etc., or combinations of, that will not exhibit this behavior. That is, the non-breaking spaces will copy and/or paste as a non-breaking space (U+00A0)?

EDIT: To provide a little more context: the application I'm working on has been localized. I suspect that most North/South American and European systems will behave similarly. I'm somewhat concerned about Asian languages and systems.

like image 596
ntownsend Avatar asked Jul 24 '09 16:07

ntownsend


1 Answers

While I'm not aware of differences between browsers in terms of how they handle copied / pasted text, I would suggest that it is actually the operating system's clipboard that would be responsible for interpreting the character encoding of an HTML page's text (only guessing here, though).

Either way - I would suggest that your best option to ensure that your copied text is interpreted correctly would be to include the lang attribute in your page elements (ref: W3C Recommendations). This would explicitly set a locale for a given element if that wasn't immediately clear by your page's content type declaration in the <head> meta data.

Outside of making sure that your HTML is semantically correct, I can't see how else you would be able to accommodate or predict regional differences.

like image 93
Phil.Wheeler Avatar answered Nov 15 '22 05:11

Phil.Wheeler