InputTextarea and emoji #3483
-
It seems that unicode characters like emojis do not count correctly in a InputTextarea. For example one smile emoji costs two characters. For example: Looked in the javascript code and found this:
This exposes the following issues:
So it seems that these functions need to be replaced with multibyte aware functions. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@DazzlingBob wasn't this already fixed in 11.0.0: primefaces/primefaces#7253 Docs: https://primefaces.github.io/primefaces/15_0_0/#/components/inputtextarea?id=inputtextarea
|
Beta Was this translation helpful? Give feedback.
-
Tried countBytesAsChars="true" but that gives a javascript error: Setting countBytesAsChars="false" solves it. See project: primefaces-test-texarea.zip Let me explain: in the database i have a field which can hold 10 utf-8 chars. So in the html spec maxlength is a number of bytes and not the number of displayed characters or glyphs. So the question is more like if someone has dealt with this kind of implementation before. |
Beta Was this translation helpful? Give feedback.
Tried countBytesAsChars="true" but that gives a javascript error:
jquery.js.xhtml?ln=primefaces&v=14.0.11:2 jQuery.Deferred exception: URI malformed URIError: URI malformed
at encodeURI ()
Setting countBytesAsChars="false" solves it. See project: primefaces-test-texarea.zip
Open project and see javascript console. Could be a bug?
Let me explain: in the database i have a field which can hold 10 utf-8 chars.
So i thought the solution is to set maxlength=10, but i can only enter 5 utf-8 characters in the textarea.
This is exact the same behavior as a normal html textarea (did not know this before).
So in the html spec maxlength is a number of bytes and not the number of displayed characters …