Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 4.1.0
-
None
Description
A non-breaking space (character 0xA0 or ALT+Space on Mac keyboard) typed into a source text is always replaced by a simple space. While this seems a good idea for any place where c++ expects white space (and cannot handle a nbsp) this also happens in string literals, like char* z=" "; (with a nbsp between " and "). This modifies behavior of the resulting program. This also happens if the code snippet is pasted in from the clipboard. This is a problem because you cannot tell by a look at the source whether it is a nbsp or a simple space.
Minimal example of the issue:
#include <QTextDocument> int main() { QString text (QChar::Nbsp); QTextDocument doc(text); QString plainText = doc.toPlainText(); return plainText != text; }
Attachments
Issue Links
- is duplicated by
-
QTCREATORBUG-28064 Qt Creator replaces legitimate UTF-8 characters (even inside strings) when saving
- Closed
- is replaced by
-
QTBUG-56538 Qt replaces non breaking spaces with "normal" spaces in documents
- Closed
- relates to
-
QTCREATORBUG-23643 Editor breaks lines at no-break spaces and joiners
- Closed