You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When copying text from Microsoft Word on Windows and pasting into a RichTextFX text field or text area there is always a null character (code point 0) at the end of the pasted text. getText().getBytes(UTF_8) shows a single 0 byte and using arrow keys in the text field/area suggests there is a single invisible character.
This doesn't happen when pasting into a standard JavaFX TextField or TextArea, or when pasting into various non-Java applications.
I have only observed this issue when copying from Microsoft Word, but according to this, it's Windows-related, and there may even be multiple null characters, although I haven't observed this.
Expected behaviour: When a string is pasted there should be no null characters at the end of the string. Actual behaviour: There is a null character at the end of the string. Environment info: RichTextFX 0.11.2, Windows 10, Java 17 and 22. Tested with StyleClassedTextArea and StyleClassedTextField.
Workaround: Is there a clean way to edit the text being pasted, preferably before it's inserted?
I figured out this way to do it by overriding the paste() method, but I'm not sure if it will cause problems for pasting formatted text:
When copying text from Microsoft Word on Windows and pasting into a RichTextFX text field or text area there is always a null character (code point 0) at the end of the pasted text.
getText().getBytes(UTF_8)
shows a single 0 byte and using arrow keys in the text field/area suggests there is a single invisible character.This doesn't happen when pasting into a standard JavaFX
TextField
orTextArea
, or when pasting into various non-Java applications.I have only observed this issue when copying from Microsoft Word, but according to this, it's Windows-related, and there may even be multiple null characters, although I haven't observed this.
Expected behaviour: When a string is pasted there should be no null characters at the end of the string.
Actual behaviour: There is a null character at the end of the string.
Environment info: RichTextFX 0.11.2, Windows 10, Java 17 and 22. Tested with
StyleClassedTextArea
andStyleClassedTextField
.Workaround: Is there a clean way to edit the text being pasted, preferably before it's inserted?
I figured out this way to do it by overriding the
paste()
method, but I'm not sure if it will cause problems for pasting formatted text:The text was updated successfully, but these errors were encountered: