You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/01/29 07:40:52 UTC

[GitHub] [lucene-solr] asalamon74 commented on pull request #2252: SOLR-15111: Use JDK8 Base64 instead of own implementation

asalamon74 commented on pull request #2252:
URL: https://github.com/apache/lucene-solr/pull/2252#issuecomment-769637051


   @madrob 
   
   **ISO_8859_1**
   
   In the first version I used UTF_8 but later I checked the source code of java.util.Base64 ( http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/util/Base64.java ) and they are using ISO-8859-1 internally, so I thought to use the same.
   ```
   public byte[] decode(String src) {
       return decode(src.getBytes(StandardCharsets.ISO_8859_1));
   }
   ```
   Probably we could use both character encodings, since base64 encoded strings only use a small subset of the characters.
   
   **encode + decode**
   
   ```
   StandardCharsets.ISO_8859_1.decode(Base64.getEncoder().encode(bytes.wrapToByteBuffer())).toString());
   ```
   
   First I base64 encode the `ByteBuffer` which gives me a `ByteBuffer` then I convert this `ByteBuffer` to `String` using Charsets decode ( https://stackoverflow.com/a/39845152 ). So it's an encode + a decode but it's a different type of encoding/decoding.
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org