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

printf "%Ns" string place holder doesn't count multi-byte characters correctly. #3099

Closed
p6rt opened this issue Apr 10, 2013 · 6 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 10, 2013

Migrated from rt.perl.org#117547 (status was 'resolved')

Searchable as RT117547$

@p6rt
Copy link
Author

p6rt commented Apr 10, 2013

From @thundergnat

p6$ perl6 -e 'map {printf "[%-18s]\n", "O" x $_ }, 0..6;'
[ ]
[O ]
[OO ]
[OOO ]
[OOOO ]
[OOOOO ]
[OOOOOO ]

perl6 -e 'map {printf "[%-18s]\n", "ಠ" x $_ }, 0..6;'
[ ]
[ಠ ]
[ಠಠ ]
[ಠಠಠ ]
[ಠಠಠಠ ]
[ಠಠಠಠಠ ]
[ಠಠಠಠಠಠ]

perl6 -e 'map {printf "[%18s]\n", "ಠ" x $_ }, 0..6;'
[ ]
[ ಠ]
[ ಠಠ]
[ ಠಠಠ]
[ ಠಠಠಠ]
[ ಠಠಠಠಠ]
[ಠಠಠಠಠಠ]

@p6rt
Copy link
Author

p6rt commented Apr 14, 2013

From @moritz

Since RT swallows some whitespace, here is a non-visual way to reproduce
the bug​:

Good​:
$ perl6 -e 'map {say chars sprintf "[%18s]\n", "." x $_ }, 0..6;'
21
21
21
21
21
21
21

Bad​:
$ perl6 -e 'map {say chars sprintf "[%18s]\n", "ಠ" x $_ }, 0..6;'
21
19
17
15
13
11
9

@p6rt
Copy link
Author

p6rt commented Apr 14, 2013

@moritz - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Apr 14, 2013

From @moritz

The underlying problem is actually a bug in parrot​:
parrot/parrot#956

@p6rt
Copy link
Author

p6rt commented Aug 23, 2013

From @FROGGS

Fixed, tests are at Raku/roast@2647c16652

@p6rt
Copy link
Author

p6rt commented Aug 23, 2013

@FROGGS - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Aug 23, 2013
@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