代码是这样的
public class Main {
public static void main(String[] args) throws Exception {
byte[] a = new byte[]{-60, -29, -45, -48, -60, -48, -59, -13, -45, -47, -62, -16};
String gbk = new String(a, "GBK");
System.out.println(gbk);
}
}
结果是
你有男朋友吗
data = [-60,-29,-45,-48,-60,-48,-59,-13,-45,-47,-62,-16]
unsigned_data = bytes(map(lambda x: x & 0xff, data))
text = unsigned_data.decode('gbk')
print(text)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
char str[] = {-28, -67, -96, -26, -100, -119, -25, -108, -73, -26, -100, -117, -27, -113, -117, -27, -112, -105,'\0'};
printf("%s\n", str);
return 0;
}
所以:你有男朋友吗