Skip to content

Commit

Permalink
change encoding to utf8 (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangtianyu authored Aug 27, 2024
1 parent c97a8a4 commit 7e31a42
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/zhongan/devpilot/util/Base64Utils.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.zhongan.devpilot.util;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class Base64Utils {
public static String base64Encoding(String code) {
return Base64.getEncoder().encodeToString(code.getBytes());
return Base64.getEncoder().encodeToString(code.getBytes(StandardCharsets.UTF_8));
}

public static String base64Decoding(String code) {
return new String(Base64.getDecoder().decode(code));
return new String(Base64.getDecoder().decode(code), StandardCharsets.UTF_8);
}
}

0 comments on commit 7e31a42

Please sign in to comment.