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

unival ignores everything but first chars #6569

Closed
p6rt opened this issue Oct 4, 2017 · 6 comments
Closed

unival ignores everything but first chars #6569

p6rt opened this issue Oct 4, 2017 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 4, 2017

Migrated from rt.perl.org#132217 (status was 'rejected')

Searchable as RT132217$

@p6rt
Copy link
Author

p6rt commented Oct 4, 2017

From @zoffixznet

Perhaps it should throw when it was given trailing stuff after the relevant char?

00​:49 dpk m​: say unival("1\x[300]23")
00​:49 camelia rakudo-moar 98fae3​: OUTPUT​: «1␤»
00​:50 dpk that … seems like a potential security issue for some apps
00​:51 m​: say unival("1\x[300]dasdsadsadsadsadasdsa")
00​:51 camelia rakudo-moar 98fae3​: OUTPUT​: «1␤»

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From @zoffixznet

uniname seems to have the same behaviour​:

<Zoffix__> m​: say uniname 'meows'
<camelia> rakudo-moar 39d50a​: OUTPUT​: «LATIN SMALL LETTER M␤»

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From @smls

On Tue, 03 Oct 2017 17​:52​:39 -0700, cpan@​zoffix.com wrote​:

Perhaps it should throw when it was given trailing stuff after the
relevant char?

00​:49 dpk m​: say unival("1\x[300]23")
00​:49 camelia rakudo-moar 98fae3​: OUTPUT​: «1␤»
00​:50 dpk that … seems like a potential security issue for some
apps
00​:51 m​: say unival("1\x[300]dasdsadsadsadsadasdsa")
00​:51 camelia rakudo-moar 98fae3​: OUTPUT​: «1␤»

I assume it's modeled after `ord`, which also does this​:

  ➜ say "Hello".ord; # 72

...which in turn probably does it because its Perl 5 version always did it​:

  $ perl -E 'say ord "Hello"
  72

Whether this is really the best thing to do, or if a warning/error would be better, I don't know.

Note that Perl 6 also has plural versions of all three of these though, which give the result for every character in the string​:

  ➜ .say for "123".ords;
  49
  50
  51

  ➜ .say for "123".uninames;
  DIGIT ONE
  DIGIT TWO
  DIGIT THREE

  ➜ .say for "123".univals;
  1
  2
  3

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 8, 2017

From @samcv

As has been pointed out, it only uses the first grapheme to look up the value similar to uniname, ord and such this isn't a bug but is expected functionality. Doing anything differently would break existing code. Going to close this as rejected.

@p6rt
Copy link
Author

p6rt commented Nov 8, 2017

@samcv - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Nov 8, 2017
@p6rt p6rt added the uni 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