Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf8-c8 confuses Str.perl #5410

Open
p6rt opened this issue Jul 1, 2016 · 3 comments
Open

utf8-c8 confuses Str.perl #5410

p6rt opened this issue Jul 1, 2016 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 1, 2016

Migrated from rt.perl.org#128513 (status was 'new')

Searchable as RT128513$

@p6rt
Copy link
Author

p6rt commented Jul 1, 2016

From zefram@fysh.org

Str.perl fails to represent whatever is being used by the utf8-c8 encoding
to represent a non-UTF-8 octet. Thus .perl.EVAL fails to round-trip
the Str that arises in the middle of a utf8-c8 decode-then-encode
round-tripping of an octet string.

Blob[uint8].new(233, 1).decode("utf8-c8").encode("utf8-c8").perl
Blob[uint8].new(233,1)
Blob[uint8].new(233, 1).decode("utf8-c8").perl.EVAL.encode("utf8-c8").perl
Blob[uint8].new(244,143,191,189,120,69,57,1)

If that mangled octet string is then used as a second input value, the
two Str values arising from decoding these two octet strings compare !eq
(as they should), but their .perl representations compare eq. This shows
that the problem is on the .perl side, rather than the .EVAL side.

-zefram

@p6rt
Copy link
Author

p6rt commented Jul 28, 2016

From zefram@fysh.org

Additional​: an apparently-null string operation, such as substituting a
substring (appearing in the Str) with itself, can mangle the string in
the same manner as .perl.EVAL​:

Blob[uint8].new(233, 1).decode("utf8-c8").subst("\x[1]", "\x[1]").encode("utf8-c8").perl
Blob[uint8].new(244,143,191,189,120,69,57,1)

-zefram

@p6rt
Copy link
Author

p6rt commented Feb 27, 2017

From zefram@fysh.org

This problem still occurs with the rewritten UTF8-C8 implementation.

-zefram

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant