Skip to content

Manifest#write blindly casts bytes to chars #20

@michael-o

Description

@michael-o
for ( byte b : byteArrayOutputStream.toByteArray() )
  {
    writer.write( (char) b );
  }

This loop is error-prone because a byte does not necessarily represent a char. If a multibyte character is encountered, the output will be mangled.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions