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
The code is correct for what its name says it does: Surrogate detection. If the input is a UTF-16 code unit. The & 0xF800 maps every integer in the range 0xD800 through 0xDFFF to 0xD800.
The only issue would be if the value was not in the range 0..0xFFFF, which means that ti's not a UTF-16 code unit. In that case you can use & ~0x7FF instead. It's probably just as efficient.
The documentation seems to suggest that it can detect multi-codeunit glyphs. That is not correct, "e\u0301" or "\r\n" are multi-character glyphs that do not use surrogates.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
lrhn commentedon Jun 17, 2020
The code is correct for what its name says it does: Surrogate detection. If the input is a UTF-16 code unit. The
& 0xF800maps every integer in the range 0xD800 through 0xDFFF to 0xD800.The only issue would be if the value was not in the range 0..0xFFFF, which means that ti's not a UTF-16 code unit. In that case you can use
& ~0x7FFinstead. It's probably just as efficient.The documentation seems to suggest that it can detect multi-codeunit glyphs. That is not correct,
"e\u0301"or"\r\n"are multi-character glyphs that do not use surrogates.justinmc commentedon Jun 18, 2020
Note to self: see also #53381 (comment).
github-actions commentedon Aug 19, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.