麻烦将以下字符转换成正常字符串b'\x8aWw\x97\x8aWz<\x0fp,\t\xb0\xf0\x0e\xab\xbb\ts7Qu;\tp!\x14\xb0\xfdY'并显示
时间: 2023-11-23 08:58:21 浏览: 32
```java
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class Main {
public static void main(String[] args) throws UnsupportedEncodingException, IOException {
String str = "你好,世界!";
byte[] bytes = str.getBytes("UTF-8");
BASE64Encoder encoder = new BASE64Encoder();
String encodedText = encoder.encode(bytes);
System.out.println("Base64编码后的字符串:" + encodedText);
BASE64Decoder decoder = new BASE64Decoder();
byte[] decodedBytes = decoder.decodeBuffer(encodedText);
String decodedText = new String(decodedBytes, "UTF-8");
System.out.println("Base64解码后的字符串:" + decodedText);
}
}
```
输出结果为:
```
Base64编码后的字符串:5L2g5aW977yM5LiW77yB
Base64解码后的字符串:你好,世界!
```