Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mschuwalow
Copy link
Member

Part of #3865

@mschuwalow mschuwalow requested a review from iravid as a code owner June 30, 2020 18:47
* This transducer uses the String constructor's behavior when handling malformed byte
* sequences.
*/
val iso8859_1: ZTransducer[Any, Nothing, Byte, String] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we call it iso8859_1Decode to be aligned with utf8Decode? And allow for a potential encoding transducer in the future.

*/
val iso8859_1: ZTransducer[Any, Nothing, Byte, String] =
ZTransducer.fromPush {
case Some(is) => ZIO.succeedNow(Chunk.single(new String(is.toArray, "ISO-8859-1")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using java.nio.charset.StandardCharsets.ISO_8859_1 might save an allocation here

* This transducer uses the String constructor's behavior when handling malformed byte
* sequences.
*/
val iso8859_1: ZTransducer[Any, Nothing, Byte, String] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the JVM the charset is referred to as 'ISO_8859_1', maybe we should add a _ after iso

@mschuwalow mschuwalow force-pushed the ztransducer#iso8859_1 branch from 2ab053c to bd0c19a Compare July 2, 2020 13:25
@mschuwalow mschuwalow requested a review from iravid July 2, 2020 13:25
@iravid iravid merged commit 5d08e4d into zio:master Jul 2, 2020
@iravid
Copy link
Member

iravid commented Jul 2, 2020

Nice work Maxim, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants