Skip to content

Conversation

@sertonix
Copy link
Contributor

Since UTF-16 works with 16-bit values it has a byte order and that byte order is not well defined. There is a convention to use U+FEFF as first character which allows determining the endianess but it's commonly not present and doesn't seem to fit into the current code. The most common thing is to assume little-endian which is what I did here and is already implied by the test suite. If supporting both big- and little-endian UTF-16 is wanted one could create _UTF16LE and _UTF16BE variations of the functions.

@necouchman
Copy link
Contributor

@sertonix Thank you very, much, we appreciate the contribution. Before we can accept and merge these changes you'll need to follow our standard contribution guidelines, which includes:

  • Requesting a Jira account and creating a Jira ticket for this change.
  • Prefixing the Pull Request and Commit Messages with the Jira issue (GUACAMOLE-XXXX:).

See the following links for more info:

@sertonix sertonix changed the title Fix GUAC_*_UTF16 on big-endian machine GUACAMOLE-2153: Fix GUAC_*_UTF16 on big-endian machine Oct 15, 2025
@sertonix
Copy link
Contributor Author

sertonix commented Nov 3, 2025

I think I did the things as requested

@necouchman
Copy link
Contributor

@sertonix Sorry, didn't catch one thing - can you rebase against the staging/1.6.1 branch so we can get this into the 1.6.1 bug fix release?

Since UTF-16 works with 16-bit values it has a byte order and that byte
order is not well defined. There is a convention to use U+FEFF as first
character which allows determining the endianess but it's commonly not
present and doesn't seem to fit into the current code. The most common
thing is to assume little-endian which is what I did here and is already
implied by the test suite. If supporting both big- and little-endian
UTF-16 is wanted one could create _UTF16LE and _UTF16BE variations of
the functions.
@sertonix sertonix changed the base branch from main to staging/1.6.1 November 3, 2025 20:02
@sertonix
Copy link
Contributor Author

sertonix commented Nov 3, 2025

Like this?

@necouchman
Copy link
Contributor

Like this?

Yep, looks good. Thank you!

@necouchman necouchman merged commit 5bfba1e into apache:staging/1.6.1 Nov 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants