ppkarwasz commented on PR #602: URL: https://github.com/apache/commons-compress/pull/602#issuecomment-2462195805
> > We should probably also provide an option to decide whether to add the name or not. > > Do you mean to not add the name if it cannot be encoded with the given Charset, or, do you mean adding an option to skip using the file name altogether and turn off the `FLG.FNAME` bit? I meant the second one, but it is a dumb proposal: you can already do that by setting `fileName` to `null`. :laughing: I would just replace: https://github.com/apache/commons-compress/blob/ec7bc35bcacb8bf0aeb0f8611c7bea0b2f93b943/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java#L138-L145 with: ```java return string.getBytes(charset); ``` The [`String.getBytes(CharSet)`](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#getBytes-java.nio.charset.Charset-) method does not throw: > This method always replaces malformed-input and unmappable-character sequences with this charset's default replacement byte array. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
