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

IO::Socket::Async should support more encodings than UTF-8 #5543

Closed
p6rt opened this issue Aug 6, 2016 · 4 comments
Closed

IO::Socket::Async should support more encodings than UTF-8 #5543

p6rt opened this issue Aug 6, 2016 · 4 comments
Labels
conc RFC Request For Comments uni

Comments

@p6rt
Copy link

p6rt commented Aug 6, 2016

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

Searchable as RT128863$

@p6rt
Copy link
Author

p6rt commented Aug 6, 2016

From @smls

To subscribe to incoming data of a connected IO​::Socket​::Async, the choices currently are​:

.Supply() -- get UTF-8 decoded data as Str
.Supply(​:bin) -- get raw data as Buf

In analogy to the open() function that takes both :bin and :enc adverbs, this should probably also accept :enc to allow dealing with text-based protocols in different encodings​:

.Supply(​:enc<utf8-c8>)

PS​: Speaking of which, maybe utf8-c8 should be the default, considering jnthn's comment here¹ that "All things coming from the OS are decoded [as utf8-c8]", and reading from a socket might be considered "from the OS".


[1] https://rt-archive.perl.org/perl6/Ticket/Display.html?id=125420#txn-1374864

@p6rt
Copy link
Author

p6rt commented Oct 12, 2016

From @jnthn

On Sat Aug 06 11​:59​:50 2016, smls75@​gmail.com wrote​:

To subscribe to incoming data of a connected IO​::Socket​::Async, the
choices currently are​:

.Supply() -- get UTF-8 decoded data as Str
.Supply(​:bin) -- get raw data as Buf

In analogy to the open() function that takes both :bin and :enc
adverbs, this should probably also accept :enc to allow dealing with
text-based protocols in different encodings​:

.Supply(​:enc<utf8-c8>)

This is now implemented. You can also set the default encoding that should apply when calling `.listen` and `.connect` (the one on .Supply always take precedence, however). That also sets the encoding for the sake of `.print`.

Tests in S32-io/IO-Socket-Async.t.

/jnthn

@p6rt
Copy link
Author

p6rt commented Oct 12, 2016

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

@p6rt p6rt closed this as completed Oct 12, 2016
@p6rt
Copy link
Author

p6rt commented Oct 12, 2016

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

@p6rt p6rt added conc RFC Request For Comments uni labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conc RFC Request For Comments uni
Projects
None yet
Development

No branches or pull requests

1 participant