-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c97a8a4
commit 7e31a42
Showing
1 changed file
with
3 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |