The nbsp entity is being replaced by a space when retrieving a element innerHTML. It seams that, while entities are converted to their relative chars, nbsp represents a special case. There are no standards for innerHTML, so we could longer discuss it here. The fact is that Safari behaves differently from IE and Firefox. Actually Firefox has addressed this issue too: https://bugzilla.mozilla.org/show_bug.cgi?id=165686
Actually, innerHTML correctly produces U+00A0, which is NO-BREAK SPACE in Unicode. I'm confirming a difference with Firefox, but lowering the priority/severity, because I don't see how this can cause problems. Feel free to raise it if this does cause issues.
Frederico, how does this behavior affect the FCKeditor?
This is not something visible in the current version of FCKeditor. It impacts on new developments I'm doing in FCKeditor for the Enter Key handler. It will be possible to control the behavior of the Enter key with more precision. Somewhere on the code, I need to check if part of the DOM (a custom range implementation) is truly empty. To do that, I need to check if the innerHTML of that range contains only "pure" spaces. It is something like innerHTML.Trim().length == 0 (Trim() is another custom one).
Based on the Alexey comment ("innerHTML correctly produces U+00A0"), I've been able to change the code to make it work for the specific FCKeditor need. So, this bug is not anymore blocking FCKeditor, but it is still a bug.
*** Bug 18769 has been marked as a duplicate of this bug. ***
Created attachment 20967 [details] proposed fix I'm not sure why escaping logic is repeated several times in markup.cpp, perhaps this file could use some refactoring. Not quite ready to do it now, though.
Comment on attachment 20967 [details] proposed fix Since there are three code paths in markup.cpp, we would need three tests to ensure we tested all three. > \ No newline at end of file Should fix that.
Committed revision 32879. Added a test case for attributes. I'm not quite sure, but looks like the third code path is for copy/paste, and cannot be easily tested.
*** Bug 20654 has been marked as a duplicate of this bug. ***
Why, why a browser should convert " " to ? I'm trying to find any explanation, any specific nbsp behavior in specifications, but I can't. So, could you explain guys why do it? And why don't you convert another specific whitespaces, such as " ", " ", " ", " ", " ", " ", " ", " ", " ", " " to entities?