public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/95959] New: Error in conversion from UTF16 to UTF8
@ 2020-06-29 11:21 simon at pushface dot org
2020-06-29 11:22 ` [Bug ada/95959] " simon at pushface dot org
2020-06-29 11:55 ` charlet at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: simon at pushface dot org @ 2020-06-29 11:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95959
Bug ID: 95959
Summary: Error in conversion from UTF16 to UTF8
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: simon at pushface dot org
Target Milestone: ---
Created attachment 48799
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48799&action=edit
Demonstration
There's an error in converting from UTF16 to UTF8 for code points in
U+10000 to u+10FFFF (which require 4 UTF8 bytes).
The attached demonstration shows this by taking a UTF8 character
(Clef, U+1D11E), converting to UTF16, and converting back to UTF8,
which should round-trip back to the same character, but doesn't. The
third byte of the final UTF8 is wrong
$ ./utftest
Codepoint: 16#1D11E#
UTF-8: 4: 2#11110000# 2#10011101# 2#10000100# 2#10011110#
UTF-16: 2: 2#1101100000110100# 2#1101110100011110#
UTF-8: 4: 2#11110000# 2#10011101# 2#10010000# 2#10011110#
Bug
The attached patch corrects the problem.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug ada/95959] Error in conversion from UTF16 to UTF8
2020-06-29 11:21 [Bug ada/95959] New: Error in conversion from UTF16 to UTF8 simon at pushface dot org
@ 2020-06-29 11:22 ` simon at pushface dot org
2020-06-29 11:55 ` charlet at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: simon at pushface dot org @ 2020-06-29 11:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95959
--- Comment #1 from simon at pushface dot org ---
Created attachment 48800
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48800&action=edit
Patch
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug ada/95959] Error in conversion from UTF16 to UTF8
2020-06-29 11:21 [Bug ada/95959] New: Error in conversion from UTF16 to UTF8 simon at pushface dot org
2020-06-29 11:22 ` [Bug ada/95959] " simon at pushface dot org
@ 2020-06-29 11:55 ` charlet at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: charlet at gcc dot gnu.org @ 2020-06-29 11:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95959
Arnaud Charlet <charlet at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
CC| |charlet at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Arnaud Charlet <charlet at gcc dot gnu.org> ---
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95953
*** This bug has been marked as a duplicate of bug 95953 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-29 11:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 11:21 [Bug ada/95959] New: Error in conversion from UTF16 to UTF8 simon at pushface dot org
2020-06-29 11:22 ` [Bug ada/95959] " simon at pushface dot org
2020-06-29 11:55 ` charlet at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).